mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 15:49:34 -05:00
Explicitly unlock the MDB lockfile on Windows.
This commit is contained in:
parent
e9d87866c4
commit
88b7bb4639
1 changed files with 11 additions and 1 deletions
|
|
@ -2806,7 +2806,9 @@ mdb_env_excl_lock(MDB_env *env, int *excl)
|
||||||
} else {
|
} else {
|
||||||
OVERLAPPED ov;
|
OVERLAPPED ov;
|
||||||
memset(&ov, 0, sizeof(ov));
|
memset(&ov, 0, sizeof(ov));
|
||||||
if (!LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) {
|
if (LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) {
|
||||||
|
*excl = 0;
|
||||||
|
} else {
|
||||||
rc = ErrCode();
|
rc = ErrCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3306,6 +3308,14 @@ mdb_env_close0(MDB_env *env, int excl)
|
||||||
munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo));
|
munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo));
|
||||||
}
|
}
|
||||||
if (env->me_lfd != INVALID_HANDLE_VALUE) {
|
if (env->me_lfd != INVALID_HANDLE_VALUE) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
if (excl >= 0) {
|
||||||
|
/* Unlock the lockfile. Windows would have unlocked it
|
||||||
|
* after closing anyway, but not necessarily at once.
|
||||||
|
*/
|
||||||
|
UnlockFile(env->me_lfd, 0, 0, 1, 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
close(env->me_lfd);
|
close(env->me_lfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue