aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/db.cpp
diff options
context:
space:
mode:
authorTim Ruffing <crypto@timruffing.de>2018-05-09 00:20:12 +0200
committerTim Ruffing <crypto@timruffing.de>2018-05-09 15:23:16 +0200
commitb6f0b4d8595df0241a6499cd57e7ddac56558bf1 (patch)
tree7e85cbb1f2ecbcd9d7187faee4b0fe4cc5d6af35 /src/wallet/db.cpp
parent264c64380978d7b0bd3ecb56a861eb004cc58b01 (diff)
wallet: Improve logging when BerkeleyDB environment fails to close
Diffstat (limited to 'src/wallet/db.cpp')
-rw-r--r--src/wallet/db.cpp9
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());