mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-06 14:19:59 -05:00
wallet: Reset BerkeleyDB handle after connection fails
According to the BerkeleyDB docs, the DbEnv handle may not be accessed after close() has been called. This change ensures that we create a new handle after close() is called. This avoids a segfault when the first connection attempt fails and then a second connection attempt tries to call open() on the already closed DbEnv handle.
This commit is contained in:
parent
a024a1841d
commit
264c643809
1 changed files with 1 additions and 0 deletions
|
@ -169,6 +169,7 @@ bool BerkeleyEnvironment::Open(bool retry)
|
||||||
S_IRUSR | S_IWUSR);
|
S_IRUSR | S_IWUSR);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
dbenv->close(0);
|
dbenv->close(0);
|
||||||
|
Reset();
|
||||||
LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret));
|
LogPrintf("BerkeleyEnvironment::Open: Error %d opening database environment: %s\n", ret, DbEnv::strerror(ret));
|
||||||
if (retry) {
|
if (retry) {
|
||||||
// try moving the database env out of the way
|
// try moving the database env out of the way
|
||||||
|
|
Loading…
Add table
Reference in a new issue