diff options
-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; |