diff options
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_disk_file.cc | 12 |
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; |