summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-05-12 19:20:01 +0000
committerChristopher Faylor <me@cgf.cx>2002-05-12 19:20:01 +0000
commitc8b20196dd4495830da99ee335528d95f7fc4e5c (patch)
tree79b7b72322e65f2fa424bdb3e9501f255a2dea4d /winsup/cygwin/fhandler_disk_file.cc
parent56caca1d1697ba826de42ba20014318b73a31ebd (diff)
downloadcygnal-c8b20196dd4495830da99ee335528d95f7fc4e5c.tar.gz
cygnal-c8b20196dd4495830da99ee335528d95f7fc4e5c.tar.bz2
cygnal-c8b20196dd4495830da99ee335528d95f7fc4e5c.zip
* fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using O_DIROPEN when
OS doesn't support it. Return proper errno in that case.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index 151b8ae42..38c6bd26f 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -374,10 +374,14 @@ fhandler_disk_file::open (path_conv *real_path, int flags, mode_t mode)
set_has_acls (real_path->has_acls ());
set_isremote (real_path->isremote ());
- if (real_path->isdir ())
- flags |= O_DIROPEN;
-
- int res = this->fhandler_base::open (real_path, flags, mode);
+ int res;
+ if (!real_path->isdir () || wincap.can_open_directories ())
+ res = this->fhandler_base::open (real_path, flags | O_DIROPEN, mode);
+ else
+ {
+ set_errno (EISDIR);
+ res = 0;
+ }
if (!res)
goto out;