diff options
author | Ron Yorston <rmy@pobox.com> | 2015-05-29 15:02:51 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2015-05-29 15:02:51 +0100 |
commit | 29eacf8ce0ec56d4b4a8b03fb6a921b4843a9ee3 (patch) | |
tree | 05ed540b8d490d0afa3a9c4105136428ab71d4e9 | |
parent | 45e8ed560702d45cf46c520b103981061e5c7ee4 (diff) | |
download | busybox-w32-29eacf8ce0ec56d4b4a8b03fb6a921b4843a9ee3.tar.gz busybox-w32-29eacf8ce0ec56d4b4a8b03fb6a921b4843a9ee3.tar.bz2 busybox-w32-29eacf8ce0ec56d4b4a8b03fb6a921b4843a9ee3.zip |
mingw: fix conditions under which open(2) sets errno to EISDIR
-rw-r--r-- | win32/mingw.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/win32/mingw.c b/win32/mingw.c index 03d4fbad4..824413586 100644 --- a/win32/mingw.c +++ b/win32/mingw.c | |||
@@ -155,7 +155,7 @@ int mingw_open (const char *filename, int oflags, ...) | |||
155 | if (filename && !strcmp(filename, "/dev/null")) | 155 | if (filename && !strcmp(filename, "/dev/null")) |
156 | filename = "nul"; | 156 | filename = "nul"; |
157 | fd = open(filename, oflags, mode); | 157 | fd = open(filename, oflags, mode); |
158 | if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) { | 158 | if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) { |
159 | DWORD attrs = GetFileAttributes(filename); | 159 | DWORD attrs = GetFileAttributes(filename); |
160 | if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) | 160 | if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) |
161 | errno = EISDIR; | 161 | errno = EISDIR; |