summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-08-23 11:14:31 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-08-23 11:14:31 +0000
commit264e076f02faca0cfd59e5b0929d74ca621119cb (patch)
tree3e1c7637ee0d5eb7aa45cde6fe5c2ab0a732299e
parentae983ffa444902e6354e68317c97fdcbc781afe6 (diff)
fixed marking db "in use" when db is running
git-svn-id: http://svn.miranda-ng.org/main/trunk@5790 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/Db3x_mmap/src/dbintf.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/Db3x_mmap/src/dbintf.cpp b/plugins/Db3x_mmap/src/dbintf.cpp
index 59640865e7..0888e8c7f9 100644
--- a/plugins/Db3x_mmap/src/dbintf.cpp
+++ b/plugins/Db3x_mmap/src/dbintf.cpp
@@ -35,11 +35,12 @@ static int OfsCompare(const ModuleName *mn1, const ModuleName *mn2 )
return ( mn1->ofs - mn2->ofs );
}
-static int stringCompare2(const char* p1, const char* p2)
-{ return strcmp(p1, p2);
+static int stringCompare2(const char *p1, const char *p2)
+{
+ return strcmp(p1, p2);
}
-CDb3Base::CDb3Base(const TCHAR* tszFileName) :
+CDb3Base::CDb3Base(const TCHAR *tszFileName) :
m_hDbFile(INVALID_HANDLE_VALUE),
m_safetyMode(true),
m_bReadOnly(true),
@@ -98,7 +99,10 @@ int CDb3Base::Load(bool bSkipInit)
log0("DB logging running");
DWORD dummy = 0;
- m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
+ if (bSkipInit)
+ m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+ else
+ m_hDbFile = CreateFile(m_tszProfileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL);
if ( m_hDbFile == INVALID_HANDLE_VALUE )
return EGROKPRF_CANTREAD;