summaryrefslogtreecommitdiff
path: root/plugins/Dbx_mdb
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-03-12 16:56:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-03-12 16:56:14 +0000
commit2d1dc453e3550d8f8b3796a376f26e7ddee58caa (patch)
tree8955eba5229dc336cfcea5c95a012804e7a04de1 /plugins/Dbx_mdb
parent256658520668e10007764fe9054e48b7a286c3fd (diff)
fix for the LMDB profile sharing
git-svn-id: http://svn.miranda-ng.org/main/trunk@12387 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dbx_mdb')
-rw-r--r--plugins/Dbx_mdb/src/dbintf.cpp2
-rw-r--r--plugins/Dbx_mdb/src/init.cpp3
-rw-r--r--plugins/Dbx_mdb/src/lmdb/mdb.c9
3 files changed, 4 insertions, 10 deletions
diff --git a/plugins/Dbx_mdb/src/dbintf.cpp b/plugins/Dbx_mdb/src/dbintf.cpp
index b4a13a78f3..728eb26f07 100644
--- a/plugins/Dbx_mdb/src/dbintf.cpp
+++ b/plugins/Dbx_mdb/src/dbintf.cpp
@@ -151,7 +151,7 @@ int CDbxMdb::Create(void)
int CDbxMdb::Check(void)
{
- HANDLE hFile = CreateFile(m_tszProfileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hFile = CreateFile(m_tszProfileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return EGROKPRF_CANTREAD;
diff --git a/plugins/Dbx_mdb/src/init.cpp b/plugins/Dbx_mdb/src/init.cpp
index b728c89bf0..dbda5a9499 100644
--- a/plugins/Dbx_mdb/src/init.cpp
+++ b/plugins/Dbx_mdb/src/init.cpp
@@ -57,9 +57,6 @@ static int makeDatabase(const TCHAR *profile)
static int grokHeader(const TCHAR *profile)
{
std::auto_ptr<CDbxMdb> db(new CDbxMdb(profile, DBMODE_SHARED | DBMODE_READONLY));
- if (db->Load(true) != ERROR_SUCCESS)
- return EGROKPRF_CANTREAD;
-
return db->Check();
}
diff --git a/plugins/Dbx_mdb/src/lmdb/mdb.c b/plugins/Dbx_mdb/src/lmdb/mdb.c
index 65ac5b7d74..2b0bad3dd1 100644
--- a/plugins/Dbx_mdb/src/lmdb/mdb.c
+++ b/plugins/Dbx_mdb/src/lmdb/mdb.c
@@ -4368,7 +4368,7 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
#ifdef _WIN32
env->me_lfd = CreateFileA(lpath, GENERIC_READ|GENERIC_WRITE,
- FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
+ FILE_SHARE_READ, NULL, OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
#else
env->me_lfd = open(lpath, O_RDWR|O_CREAT|MDB_CLOEXEC, mode);
@@ -4646,8 +4646,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
len = OPEN_ALWAYS;
}
mode = FILE_ATTRIBUTE_NORMAL;
- env->me_fd = CreateFileA(dpath, oflags, FILE_SHARE_READ|FILE_SHARE_WRITE,
- NULL, len, mode, NULL);
+ env->me_fd = CreateFileA(dpath, oflags, FILE_SHARE_READ, NULL, len, mode, NULL);
#else
if (F_ISSET(flags, MDB_RDONLY))
oflags = O_RDONLY;
@@ -4676,9 +4675,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
*/
#ifdef _WIN32
len = OPEN_EXISTING;
- env->me_mfd = CreateFileA(dpath, oflags,
- FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, len,
- mode | FILE_FLAG_WRITE_THROUGH, NULL);
+ env->me_mfd = CreateFileA(dpath, oflags, FILE_SHARE_READ, NULL, len, mode | FILE_FLAG_WRITE_THROUGH, NULL);
#else
oflags &= ~O_CREAT;
env->me_mfd = open(dpath, oflags | MDB_DSYNC, mode);