summaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc12
2 files changed, 14 insertions, 4 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 01f8d0c08..27f1292c8 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2002-05-12 Christopher Faylor <cgf@redhat.com>
+ * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using
+ O_DIROPEN when OS doesn't support it. Return proper errno in that
+ case.
+
+2002-05-12 Christopher Faylor <cgf@redhat.com>
+
* syscalls.cc (_read): Change error to EBADF if attempt to read from a
non-readable fd.
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;