From c8b20196dd4495830da99ee335528d95f7fc4e5c Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Sun, 12 May 2002 19:20:01 +0000 Subject: [PATCH] * fhandler_disk_file.cc (fhandler_disk_file::open): Avoid using O_DIROPEN when OS doesn't support it. Return proper errno in that case. --- winsup/cygwin/ChangeLog | 6 ++++++ 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,3 +1,9 @@ +2002-05-12 Christopher Faylor + + * 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 * syscalls.cc (_read): Change error to EBADF if attempt to read from a 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;