Browse Source

close old db when rewriting

miguelfreitas
Pieter Wuille 13 years ago committed by Gavin Andresen
parent
commit
f53c5ede73
  1. 2
      src/db.cpp

2
src/db.cpp

@ -195,6 +195,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) @@ -195,6 +195,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
bool fSuccess = true;
printf("Rewriting %s...\n", strFile.c_str());
string strFileRes = strFile + ".rewrite";
{ // surround usage of db with extra {}
CDB db(strFile.c_str(), "r");
Db* pdbCopy = new Db(&dbenv, 0);
@ -251,6 +252,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip) @@ -251,6 +252,7 @@ bool CDB::Rewrite(const string& strFile, const char* pszSkip)
fSuccess = false;
delete pdbCopy;
}
}
if (fSuccess)
{
Db dbA(&dbenv, 0);

Loading…
Cancel
Save