aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2023-01-26 07:38:13 +0000
committerRon Yorston <rmy@pobox.com>2023-01-26 07:38:13 +0000
commit073e14482ba493687f892f1a2deedde822220b06 (patch)
tree99f662d5a4a20b462169b1024a2d4bfe2276c1b2
parente29a106453a90e3b0a7379a69a79487276575c7e (diff)
downloadbusybox-w32-073e14482ba493687f892f1a2deedde822220b06.tar.gz
busybox-w32-073e14482ba493687f892f1a2deedde822220b06.tar.bz2
busybox-w32-073e14482ba493687f892f1a2deedde822220b06.zip
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)
-rw-r--r--win32/mingw.c2
1 files changed, 1 insertions, 1 deletions
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)
445 445
446 /* Open file and try to avoid updating access time */ 446 /* Open file and try to avoid updating access time */
447 fh = CreateFileA(name, GENERIC_READ | FILE_WRITE_ATTRIBUTES, 447 fh = CreateFileA(name, GENERIC_READ | FILE_WRITE_ATTRIBUTES,
448 0, NULL, OPEN_EXISTING, 0, NULL); 448 FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
449 if (fh != INVALID_HANDLE_VALUE) { 449 if (fh != INVALID_HANDLE_VALUE) {
450 FILETIME last_access = { 0xffffffff, 0xffffffff }; 450 FILETIME last_access = { 0xffffffff, 0xffffffff };
451 451