aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db.cpp7
-rw-r--r--src/db.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp
index 297240c842..21c3da4cda 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -38,11 +38,13 @@ void CDBEnv::EnvShutdown()
if (ret != 0)
printf("EnvShutdown exception: %s (%d)\n", DbEnv::strerror(ret), ret);
if (!fMockDb)
- DbEnv(0).remove(GetDataDir().string().c_str(), 0);
+ DbEnv(0).remove(strPath.c_str(), 0);
}
CDBEnv::CDBEnv() : dbenv(DB_CXX_NO_EXCEPTIONS)
{
+ fDbEnvInit = false;
+ fMockDb = false;
}
CDBEnv::~CDBEnv()
@@ -65,6 +67,7 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_)
pathEnv = pathEnv_;
filesystem::path pathDataDir = pathEnv;
+ strPath = pathDataDir.string();
filesystem::path pathLogDir = pathDataDir / "database";
filesystem::create_directory(pathLogDir);
filesystem::path pathErrorFile = pathDataDir / "db.log";
@@ -85,7 +88,7 @@ bool CDBEnv::Open(boost::filesystem::path pathEnv_)
dbenv.set_flags(DB_AUTO_COMMIT, 1);
dbenv.set_flags(DB_TXN_WRITE_NOSYNC, 1);
dbenv.log_set_config(DB_LOG_AUTO_REMOVE, 1);
- int ret = dbenv.open(pathDataDir.string().c_str(),
+ int ret = dbenv.open(strPath.c_str(),
DB_CREATE |
DB_INIT_LOCK |
DB_INIT_LOG |
diff --git a/src/db.h b/src/db.h
index 798913645f..58e9da31f2 100644
--- a/src/db.h
+++ b/src/db.h
@@ -37,6 +37,7 @@ private:
bool fDbEnvInit;
bool fMockDb;
boost::filesystem::path pathEnv;
+ std::string strPath;
void EnvShutdown();