summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index c68599246..af26e008b 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -969,6 +969,12 @@ open (const char *unix_path, int flags, ...)
res = -1;
set_errno (ELOOP);
}
+ else if ((flags & O_DIRECTORY) && !fh->pc.isdir ())
+ {
+ delete fh;
+ res = -1;
+ set_errno (ENOTDIR);
+ }
else if (((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) && fh->exists ())
{
delete fh;