From 5a45c4a2109bb01160acdad1f071439d89e7f04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Wed, 12 Oct 2022 18:00:05 +0300 Subject: [PATCH] =?UTF-8?q?mdbx-windows:=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D0=B0=20`LockFile?= =?UTF-8?q?Ex()`=20=D0=B2=D0=BD=D1=83=D1=82=D1=80=D0=B8=20`mdbx=5Fenv=5Fco?= =?UTF-8?q?py()`.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core.c b/src/core.c index 479ca8de..634969a5 100644 --- a/src/core.c +++ b/src/core.c @@ -20532,14 +20532,10 @@ LIBMDBX_API int mdbx_env_copyW(MDBX_env *env, const wchar_t *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; @@ -20554,8 +20550,8 @@ LIBMDBX_API int mdbx_env_copyW(MDBX_env *env, const wchar_t *dest_path, #endif /* Linux */ ) rc = errno; -#endif /* Windows / POSIX */ } +#endif /* Windows / POSIX */ if (rc == MDBX_SUCCESS) rc = mdbx_env_copy2fd(env, newfd, flags);