Skip to content

Commit f171fee

Browse files
ajweissluke-jr
authored andcommitted
Handle leveldb::DestroyDB() errors on wipe failure
Add error checking to CLevelDBWrapper for errors from leveldb::DestroyDB(). Without it, if unlink() or DeleteFileW() fail to delete files, they will fail silent. If they fail to delete any files, CLevelDBWrapper will silently open and read the existing database. Typically any permissions issues would be caught by leveldb as it churns through many files as part of its compaction process, but it is conceivable that this could cause problems on Windows with anti-virus and indexing software.
1 parent c5b89fe commit f171fee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/leveldbwrapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCa
5858
} else {
5959
if (fWipe) {
6060
LogPrintf("Wiping LevelDB in %s\n", path.string());
61-
leveldb::DestroyDB(path.string(), options);
61+
leveldb::Status result = leveldb::DestroyDB(path.string(), options);
62+
HandleError(result);
6263
}
6364
TryCreateDirectory(path);
6465
LogPrintf("Opening LevelDB in %s\n", path.string());

0 commit comments

Comments
 (0)