mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 18:44:13 +08:00
mdbx-windows: drop needless LockFileEx()
inside mdbx_env_copy()
(backport).
This commit is contained in:
parent
8505203080
commit
50e9e0e561
10
src/core.c
10
src/core.c
@ -19853,14 +19853,10 @@ __cold int mdbx_env_copy(MDBX_env *env, const char *dest_path,
|
||||
#endif
|
||||
);
|
||||
|
||||
if (rc == MDBX_SUCCESS) {
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
OVERLAPPED ov;
|
||||
memset(&ov, 0, sizeof(ov));
|
||||
if (!LockFileEx(newfd, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
|
||||
0, 0, INT32_MAX, &ov))
|
||||
rc = GetLastError();
|
||||
/* no locking required since the file opened with ShareMode == 0 */
|
||||
#else
|
||||
if (rc == MDBX_SUCCESS) {
|
||||
struct flock lock_op;
|
||||
memset(&lock_op, 0, sizeof(lock_op));
|
||||
lock_op.l_type = F_WRLCK;
|
||||
@ -19875,8 +19871,8 @@ __cold int mdbx_env_copy(MDBX_env *env, const char *dest_path,
|
||||
#endif /* Linux */
|
||||
)
|
||||
rc = errno;
|
||||
#endif /* Windows / POSIX */
|
||||
}
|
||||
#endif /* Windows / POSIX */
|
||||
|
||||
if (rc == MDBX_SUCCESS)
|
||||
rc = mdbx_env_copy2fd(env, newfd, flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user