Skip to content

Commit

Permalink
wallet: Close dbenv error file db.log
Browse files Browse the repository at this point in the history
The error file db.log is opened by BerkeleyEnvironment instance and
should be closed after dbenv is closed.

Github-Pull: bitcoin#15297
Rebased-From: 8602a1e
  • Loading branch information
promag committed Mar 12, 2019
1 parent f20513b commit 22cdb6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wallet/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ void BerkeleyEnvironment::Close()
}
}

FILE* error_file = nullptr;
dbenv->get_errfile(&error_file);

int ret = dbenv->close(0);
if (ret != 0)
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);

if (error_file) fclose(error_file);
}

void BerkeleyEnvironment::Reset()
Expand Down

0 comments on commit 22cdb6c

Please sign in to comment.