diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-03 12:04:20 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-03-03 12:04:20 +0000 |
commit | 0e3a293ce9f7b361b0d5d9528738d596dfe4d565 (patch) | |
tree | 8dbb0f54e53fba47da317127f3cb0aa27ecc8e83 /plugins/Dbx_mdb | |
parent | 0e60689b22b0fd7aaef2cdc7c3789b9bc6c7f00a (diff) |
dbx_lmdb: fix crash in read-only mode
git-svn-id: http://svn.miranda-ng.org/main/trunk@16402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r-- | plugins/Dbx_mdb/src/dbintf.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp index 4124ad5fbf..db41a585b0 100644 --- a/plugins/Dbx_mdb/src/dbintf.cpp +++ b/plugins/Dbx_mdb/src/dbintf.cpp @@ -98,13 +98,15 @@ int CDbxMdb::Load(bool bSkipInit) if (!bSkipInit) {
txn_ptr trnlck(m_pMdbEnv);
- mdb_dbi_open(trnlck, "global", MDB_CREATE | MDB_INTEGERKEY, &m_dbGlobal);
- mdb_dbi_open(trnlck, "crypto", MDB_CREATE, &m_dbCrypto);
- mdb_dbi_open(trnlck, "contacts", MDB_CREATE | MDB_INTEGERKEY, &m_dbContacts);
- mdb_dbi_open(trnlck, "modules", MDB_CREATE | MDB_INTEGERKEY, &m_dbModules);
- mdb_dbi_open(trnlck, "events", MDB_CREATE | MDB_INTEGERKEY, &m_dbEvents);
- mdb_dbi_open(trnlck, "eventsrt", MDB_CREATE | MDB_INTEGERKEY, &m_dbEventsSort);
- mdb_dbi_open(trnlck, "settings", MDB_CREATE, &m_dbSettings);
+ unsigned int defFlags = MDB_CREATE;
+
+ mdb_dbi_open(trnlck, "global", defFlags | MDB_INTEGERKEY, &m_dbGlobal);
+ mdb_dbi_open(trnlck, "crypto", defFlags, &m_dbCrypto);
+ mdb_dbi_open(trnlck, "contacts", defFlags | MDB_INTEGERKEY, &m_dbContacts);
+ mdb_dbi_open(trnlck, "modules", defFlags | MDB_INTEGERKEY, &m_dbModules);
+ mdb_dbi_open(trnlck, "events", defFlags | MDB_INTEGERKEY, &m_dbEvents);
+ mdb_dbi_open(trnlck, "eventsrt", defFlags | MDB_INTEGERKEY, &m_dbEventsSort);
+ mdb_dbi_open(trnlck, "settings", defFlags, &m_dbSettings);
//mdb_set_compare(trnlck, m_dbEventsSort, EventsComparator);
@@ -212,9 +214,9 @@ bool CDbxMdb::Map() mdb_env_set_mapsize(m_pMdbEnv, m_dwFileSize);
int mode = MDB_NOSYNC | MDB_NOSUBDIR | MDB_NOLOCK; // nolock - miranda using m_csDbAccess lock
- if (m_bReadOnly)
- mode |= MDB_RDONLY;
- else
+// if (m_bReadOnly)
+// mode |= MDB_RDONLY;
+// else
mode |= MDB_WRITEMAP;
return mdb_env_open(m_pMdbEnv, _T2A(m_tszProfileName), mode, 0664) == MDB_SUCCESS;
}
|