diff options
author | Adam Weiss <adam@signal11.com> | 2015-08-12 19:32:20 -0400 |
---|---|---|
committer | Adam Weiss <adam@signal11.com> | 2015-08-12 19:40:09 -0400 |
commit | 243b80d29235b07f8a26fb51e2af3a949c8fc1fd (patch) | |
tree | b30c148ee1cd12a1b724704f3222afbd5a143d4b /src/leveldbwrapper.cpp | |
parent | 87f37e259d6deb52ee464edde7aece687eea97a5 (diff) |
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.
Diffstat (limited to 'src/leveldbwrapper.cpp')
-rw-r--r-- | src/leveldbwrapper.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp index c353dfa6d9..26cacf95ae 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()); |