diff options
Diffstat (limited to 'winsup/cygwin/fhandler.cc')
-rw-r--r-- | winsup/cygwin/fhandler.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index f47805bde..25f167247 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -590,7 +590,13 @@ fhandler_base::open (int flags, mode_t mode) create_disposition, create_options, NULL, 0); if (!NT_SUCCESS (status)) { - __seterrno_from_nt_status (status); + /* Trying to open a directory should return EISDIR, not ENOENT. */ + PUNICODE_STRING upath = pc.get_nt_native_path (); + if (status == STATUS_OBJECT_NAME_INVALID + && upath->Buffer[upath->Length / sizeof (WCHAR) - 1] == '\\') + set_errno (EISDIR); + else + __seterrno_from_nt_status (status); if (!nohandle ()) goto done; } |