From 5bf785a017482da9b87a141e91f91a07a4d433d0 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 19 Sep 2002 03:30:20 +0000 Subject: * cygthread.cc (cygthread::initialized): Avoid copying on fork or some threads may not end up in the pool. (cygthread::new): Avoid race when checking for initialized. Add debugging code. * fhandler.cc (fhandler_base::raw_read): Add case for ERROR_INVALID_HANDLE due to Win95 directories. (fhandler_base::open): Handle errors due to Win95 directories. (fhandler_base::close): Add get_nohandle () test. (fhandler_base::set_close_on_exec): Ditto. (fhandler_base::fork_fixup): Ditto. (fhandler_base::lock): Change error code to Posix EINVAL. (fhandler_base::dup): If get_nohandle (), set new value to INVALID_HANDLE_VALUE instead of NULL. * fhandler_disk_file.cc (fhandler_disk_file::fstat): Call fstat_by_name if get_nohandle (). Remove extraneous element from strpbrk. (fhandler_disk_file::open): Remove test for Win95 directory. * fhandler_random.cc (fhandler_dev_random::open): Add set_nohandle (). * fhandler_clipboard.cc (fhandler_dev_clipboard::open): Ditto. * fhandler_zero.cc (fhandler_dev_zero::open): Ditto. (fhandler_dev_zero::close): Delete. * fhandler.h (class fhandler_dev_zero): Ditto. --- winsup/cygwin/fhandler_disk_file.cc | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 84698efe9..d6f84fd74 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -156,8 +156,12 @@ fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc) bool query_open_already; if (get_io_handle ()) - return fstat_by_handle (buf, pc); - + { + if (get_nohandle ()) + return fstat_by_name (buf, pc); + else + return fstat_by_handle (buf, pc); + } /* If we don't care if the file is executable or we already know if it is, then just do a "query open" as it is apparently much faster. */ if (pc->exec_state () != dont_know_if_executable) @@ -166,7 +170,7 @@ fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc) query_open_already = false; if (query_open_already && strncasematch (pc->volname (), "FAT", 3) - && !strpbrk (get_win32_name (), "?*|<>|")) + && !strpbrk (get_win32_name (), "?*|<>")) oret = 0; else if (!(oret = open (pc, open_flags, 0))) { @@ -191,7 +195,7 @@ fhandler_disk_file::fstat (struct __stat64 *buf, path_conv *pc) } } - if (!oret) + if (!oret || get_nohandle ()) res = fstat_by_name (buf, pc); else { @@ -363,15 +367,7 @@ 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 ()); - 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; - } - + int res = this->fhandler_base::open (real_path, flags | O_DIROPEN, mode); if (!res) goto out; @@ -790,7 +786,7 @@ fhandler_cygdrive::readdir (DIR *dir) dir->__d_position++; pdrive = strchr (pdrive, '\0') + 1; syscall_printf ("%p = readdir (%p) (%s)", &dir->__d_dirent, dir, - dir->__d_dirent->d_name); + dir->__d_dirent->d_name); return dir->__d_dirent; } -- cgit v1.2.3