From d0ddc8569b9147c6f4aab559ef4a595e364306c3 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Fri, 4 May 2018 01:52:17 +0300 Subject: [PATCH] mdbx-windows: fix lck_reader_alive_check(). Change-Id: Icbc54d9b3003f70bba573a3807c5161380339460 --- src/lck-windows.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lck-windows.c b/src/lck-windows.c index 67e989ae..319de8ca 100644 --- a/src/lck-windows.c +++ b/src/lck-windows.c @@ -546,10 +546,12 @@ int mdbx_rpid_clear(MDBX_env *env) { * or otherwise the errcode. */ int mdbx_rpid_check(MDBX_env *env, mdbx_pid_t pid) { (void)env; - HANDLE hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, pid); + HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, pid); int rc; - if (hProcess) { + if (likely(hProcess)) { rc = WaitForSingleObject(hProcess, 0); + if (unlikely(rc == WAIT_FAILED)) + rc = GetLastError(); CloseHandle(hProcess); } else { rc = GetLastError();