From c80a8e246d340af8a5e0a9254c5c7042bf141192 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Fri, 9 Aug 2024 17:27:40 +0100 Subject: win32: fix another problem with stat(2) If we can't open a file to preserve its access time (perhaps because it doesn't belong to us) just try again without bothering about the access time. I thought I'd already done that, but that must have been in an alternative reality. Adds 16 bytes. (GitHub issue #443) --- win32/mingw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/win32/mingw.c b/win32/mingw.c index 97bc95d8e..a7540d220 100644 --- a/win32/mingw.c +++ b/win32/mingw.c @@ -462,9 +462,10 @@ static int has_exec_format(const char *name) } if (fd < 0) - return 0; + n = open_read_close(name, buf, sizeof(buf)); + else + n = read_close(fd, buf, sizeof(buf)); - n = read_close(fd, buf, sizeof(buf)); if (n < 4) /* Need at least a few bytes and no error */ return 0; -- cgit v1.2.3-55-g6feb