[*_restore] Fix leaking file descriptor (#89)

This commit is contained in:
csonto 2017-11-14 16:09:11 +01:00 committed by Joe Thornber
parent 1253d720e9
commit 39809c17b2
1 changed files with 2 additions and 0 deletions

View File

@ -151,6 +151,8 @@ file_utils::zero_superblock(std::string const &path)
memset(buffer, 0, SUPERBLOCK_SIZE);
if (::write(fd, buffer, SUPERBLOCK_SIZE) != SUPERBLOCK_SIZE)
throw runtime_error("couldn't zero superblock");
::close(fd);
}
//----------------------------------------------------------------