aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-12-04 15:43:30 +0000
committerRon Yorston <rmy@pobox.com>2018-12-04 15:43:30 +0000
commit5448a3893434a64d184055be81a58f47ea6af51b (patch)
tree9e42b374aa2bb0f3f85687551684964f0c99f49c
parentaacf801b253e1e608ab46a4ccee87e943734742e (diff)
downloadbusybox-w32-5448a3893434a64d184055be81a58f47ea6af51b.tar.gz
busybox-w32-5448a3893434a64d184055be81a58f47ea6af51b.tar.bz2
busybox-w32-5448a3893434a64d184055be81a58f47ea6af51b.zip
win32: fix implementation of access(2)
The WIN32 implementation of access(2) didn't return: - the correct value when a directory was tested for X_OK; - the correct error code when the target existed but execute permission wasn't available.
-rw-r--r--win32/mingw.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/win32/mingw.c b/win32/mingw.c
index 7568f081d..707e6a3d2 100644
--- a/win32/mingw.c
+++ b/win32/mingw.c
@@ -1142,8 +1142,11 @@ int mingw_access(const char *name, int mode)
1142 } 1142 }
1143 } 1143 }
1144 1144
1145 if (!mingw_stat(name, &s) && S_ISREG(s.st_mode) && (s.st_mode&S_IXUSR)) { 1145 if (!mingw_stat(name, &s)) {
1146 return 0; 1146 if ((s.st_mode&S_IXUSR)) {
1147 return 0;
1148 }
1149 errno = EACCES;
1147 } 1150 }
1148 1151
1149 return -1; 1152 return -1;