From 073e14482ba493687f892f1a2deedde822220b06 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Thu, 26 Jan 2023 07:38:13 +0000 Subject: win32: another stat(2) + access time fix Use FILE_SHARE_READ when opening a file to check if it's an executable. Without that other processes running in parallel might be unable to access the file. (GitHub issue #284) --- win32/mingw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/win32/mingw.c b/win32/mingw.c index 75e6c3f24..5cd7e74db 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -445,7 +445,7 @@ static int has_exec_format(const char *name) /* Open file and try to avoid updating access time */ fh = CreateFileA(name, GENERIC_READ | FILE_WRITE_ATTRIBUTES, - 0, NULL, OPEN_EXISTING, 0, NULL); + FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); if (fh != INVALID_HANDLE_VALUE) { FILETIME last_access = { 0xffffffff, 0xffffffff }; -- cgit v1.2.3-55-g6feb