Skip to content

Commit 8390d5c

Browse files
committed
Merge branch 'js/windows-open-eisdir-error' into maint
open() emulated on Windows platforms did not give EISDIR upon an attempt to open a directory for writing. * js/windows-open-eisdir-error: Windows: correct detection of EISDIR in mingw_open()
2 parents 5d509d5 + ba6fad0 commit 8390d5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compat/mingw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ int mingw_open (const char *filename, int oflags, ...)
312312
return -1;
313313
fd = _wopen(wfilename, oflags, mode);
314314

315-
if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
315+
if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) {
316316
DWORD attrs = GetFileAttributesW(wfilename);
317317
if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
318318
errno = EISDIR;

0 commit comments

Comments
 (0)