summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r--winsup/cygwin/fhandler.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index 98c48064d..eded21ee8 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -592,7 +592,7 @@ fhandler_base::open (int flags, mode_t mode)
{
/* Trying to create a directory should return EISDIR, not ENOENT. */
PUNICODE_STRING upath = pc.get_nt_native_path ();
- if (status == STATUS_OBJECT_NAME_INVALID
+ if (status == STATUS_OBJECT_NAME_INVALID && (flags & O_CREAT)
&& upath->Buffer[upath->Length / sizeof (WCHAR) - 1] == '\\')
set_errno (EISDIR);
else