summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-22 12:17:13 -0800
committerJunio C Hamano <gitster@pobox.com>2014-12-22 12:17:13 -0800
commit8390d5cda9a4da982837bac1822d9ab3cf3f7ad9 (patch)
tree57c49a8ba854affa77a3076a1186901d1b8444b1
parent5d509d5e1cf1feb9e218b431f4ea41b10e39d06e (diff)
parentba6fad02b6cbbfbf5acf3303b4d8ddfd8624fdb2 (diff)
downloadgit-8390d5cda9a4da982837bac1822d9ab3cf3f7ad9.tar.gz
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()
-rw-r--r--compat/mingw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index c5c37e53ce..70f3191a4f 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -312,7 +312,7 @@ int mingw_open (const char *filename, int oflags, ...)
return -1;
fd = _wopen(wfilename, oflags, mode);
- if (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {
+ if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) {
DWORD attrs = GetFileAttributesW(wfilename);
if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
errno = EISDIR;