aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2024-08-09 17:27:40 +0100
committerRon Yorston <rmy@pobox.com>2024-08-09 17:27:40 +0100
commitc80a8e246d340af8a5e0a9254c5c7042bf141192 (patch)
tree105fa810f64c7210823b67da89ae9beba9ed1c18
parente90345c1048f2c53074a1bd88e7870ee6a452b01 (diff)
downloadbusybox-w32-c80a8e246d340af8a5e0a9254c5c7042bf141192.tar.gz
busybox-w32-c80a8e246d340af8a5e0a9254c5c7042bf141192.tar.bz2
busybox-w32-c80a8e246d340af8a5e0a9254c5c7042bf141192.zip
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)
-rw-r--r--win32/mingw.c5
1 files 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)
462 } 462 }
463 463
464 if (fd < 0) 464 if (fd < 0)
465 return 0; 465 n = open_read_close(name, buf, sizeof(buf));
466 else
467 n = read_close(fd, buf, sizeof(buf));
466 468
467 n = read_close(fd, buf, sizeof(buf));
468 if (n < 4) /* Need at least a few bytes and no error */ 469 if (n < 4) /* Need at least a few bytes and no error */
469 return 0; 470 return 0;
470 471