aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Weiss <adam@signal11.com>2015-08-12 19:32:20 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2015-09-21 05:21:30 +0000
commit28d76d2aea6508e26def7e59a6ff006d0cad6b86 (patch)
treed7090361c92ee24c1e092e6fd568daa2bee39e5b
parent843469ee15be64070eaf01c34b4590185be18db3 (diff)
downloadbitcoin-28d76d2aea6508e26def7e59a6ff006d0cad6b86.tar.xz
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.
-rw-r--r--src/leveldbwrapper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp
index 70980fede5..1f674a91df 100644
--- a/src/leveldbwrapper.cpp
+++ b/src/leveldbwrapper.cpp
@@ -58,7 +58,8 @@ CLevelDBWrapper::CLevelDBWrapper(const boost::filesystem::path& path, size_t nCa
} else {
if (fWipe) {
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);
LogPrintf("Opening LevelDB in %s\n", path.string());