diff options
Diffstat (limited to 'src/db.cpp')
| -rw-r--r-- | src/db.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/db.cpp b/src/db.cpp index cbcbd3faa..a0b9dc20f 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying -// file license.txt or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "db.h" #include "util.h" @@ -76,6 +76,10 @@ CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL) if (fCreate) nFlags |= DB_CREATE; + unsigned int nEnvFlags = 0; + if (GetBoolArg("-privdb", true)) + nEnvFlags |= DB_PRIVATE; + { LOCK(cs_db); if (!fDbEnvInit) @@ -96,6 +100,7 @@ CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL) dbenv.set_lk_max_locks(10000); dbenv.set_lk_max_objects(10000); dbenv.set_errfile(fopen(pathErrorFile.string().c_str(), "a")); /// debug + dbenv.set_flags(DB_TXN_WRITE_NOSYNC, 1); dbenv.set_flags(DB_AUTO_COMMIT, 1); dbenv.log_set_config(DB_LOG_AUTO_REMOVE, 1); ret = dbenv.open(pathDataDir.string().c_str(), @@ -105,7 +110,8 @@ CDB::CDB(const char *pszFile, const char* pszMode) : pdb(NULL) DB_INIT_MPOOL | DB_INIT_TXN | DB_THREAD | - DB_RECOVER, + DB_RECOVER | + nEnvFlags, S_IRUSR | S_IWUSR); if (ret > 0) throw runtime_error(strprintf("CDB() : error %d opening database environment", ret)); |