summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Dbx_mdbx/src/dbintf.cpp4
-rw-r--r--src/mir_app/src/database.cpp9
2 files changed, 9 insertions, 4 deletions
diff --git a/plugins/Dbx_mdbx/src/dbintf.cpp b/plugins/Dbx_mdbx/src/dbintf.cpp
index 5ecac705be..ee0c7b8e3c 100644
--- a/plugins/Dbx_mdbx/src/dbintf.cpp
+++ b/plugins/Dbx_mdbx/src/dbintf.cpp
@@ -194,5 +194,7 @@ int CDbxMDBX::Map()
unsigned int mode = MDBX_NOSUBDIR | MDBX_MAPASYNC | MDBX_WRITEMAP | MDBX_NOSYNC;
if (m_bReadOnly)
mode |= MDBX_RDONLY;
- return mdbx_env_open(m_env, _T2A(m_tszProfileName), mode, 0664);
+
+ int exclusive = (m_bShared) ? 1 : 2;
+ return mdbx_env_open_ex(m_env, _T2A(m_tszProfileName), mode, 0664, &exclusive);
}
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp
index ce47bd9981..f0dbfa8077 100644
--- a/src/mir_app/src/database.cpp
+++ b/src/mir_app/src/database.cpp
@@ -505,19 +505,22 @@ int LoadDatabaseModule(void)
}
else if (rc > 0) {
// if there were drivers but they all failed cos the file is locked, try and find the miranda which locked it
+ if (FindMirandaForProfile(szProfile))
+ break;
+
if (fileExist(szProfile)) {
// file isn't locked, just no driver could open it.
MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszUnknownFormat), ptszFileName),
TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
}
- else if (!FindMirandaForProfile(szProfile)) {
+ else
retry = IDRETRY == MessageBox(nullptr,
CMStringW(FORMAT, TranslateW(tszProfileLocked), ptszFileName),
TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR);
- }
}
- } while (retry);
+ }
+ while (retry);
if (rc == ERROR_SUCCESS) {
InitIni();