diff options
author | Tim Ruffing <crypto@timruffing.de> | 2018-05-09 00:20:12 +0200 |
---|---|---|
committer | Tim Ruffing <crypto@timruffing.de> | 2018-05-09 15:23:16 +0200 |
commit | b6f0b4d8595df0241a6499cd57e7ddac56558bf1 (patch) | |
tree | 7e85cbb1f2ecbcd9d7187faee4b0fe4cc5d6af35 | |
parent | 264c64380978d7b0bd3ecb56a861eb004cc58b01 (diff) | |
download | bitcoin-b6f0b4d8595df0241a6499cd57e7ddac56558bf1.tar.xz |
wallet: Improve logging when BerkeleyDB environment fails to close
-rw-r--r-- | src/wallet/db.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wallet/db.cpp b/src/wallet/db.cpp index adf6944280..7e75ee7ad1 100644 --- a/src/wallet/db.cpp +++ b/src/wallet/db.cpp @@ -102,7 +102,7 @@ void BerkeleyEnvironment::Close() int ret = dbenv->close(0); if (ret != 0) - LogPrintf("BerkeleyEnvironment::EnvShutdown: Error %d shutting down database environment: %s\n", ret, DbEnv::strerror(ret)); + LogPrintf("BerkeleyEnvironment::Close: Error %d closing database environment: %s\n", ret, DbEnv::strerror(ret)); if (!fMockDb) DbEnv((u_int32_t)0).remove(strPath.c_str(), 0); } @@ -168,9 +168,12 @@ bool BerkeleyEnvironment::Open(bool retry) nEnvFlags, S_IRUSR | S_IWUSR); if (ret != 0) { - dbenv->close(0); - Reset(); LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret)); + int ret2 = dbenv->close(0); + if (ret2 != 0) { + LogPrintf("BerkeleyEnvironment::Open: Error %d closing failed database environment: %s\n", ret2, DbEnv::strerror(ret2)); + } + Reset(); if (retry) { // try moving the database env out of the way fs::path pathDatabaseBak = pathIn / strprintf("database.%d.bak", GetTime()); |