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.
This commit is contained in:
parent
87f37e259d
commit
243b80d292
1 changed files with 2 additions and 1 deletions
|
@ -58,7 +58,8 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCa
|
||||||
} else {
|
} else {
|
||||||
if (fWipe) {
|
if (fWipe) {
|
||||||
LogPrintf("Wiping LevelDB in %s\n", path.string());
|
LogPrintf("Wiping LevelDB in %s\n", path.string());
|
||||||
leveldb::DestroyDB(path.string(), options);
|
leveldb::Status result = leveldb::DestroyDB(path.string(), options);
|
||||||
|
HandleError(result);
|
||||||
}
|
}
|
||||||
TryCreateDirectory(path);
|
TryCreateDirectory(path);
|
||||||
LogPrintf("Opening LevelDB in %s\n", path.string());
|
LogPrintf("Opening LevelDB in %s\n", path.string());
|
||||||
|
|
Loading…
Reference in a new issue