From dad546a5ebf3b21179e2e1d9574f972112d39d9c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 14 May 2005 21:12:10 +0000 Subject: * fhandler_disk_file.cc (fhandler_base::fstat_by_handle): Check return code from GetFileSize and set file size to 0 if necessary. * fhandler_netdrive.cc (fhandler_netdrive::fstat): Set permissions to read/execute for all. --- winsup/cygwin/fhandler_disk_file.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (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 ff14a053a..ca9f1fab3 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -148,11 +148,16 @@ fhandler_base::fstat_by_handle (struct __stat64 *buf) BOOL res = GetFileInformationByHandle (get_handle (), &local); debug_printf ("%d = GetFileInformationByHandle (%s, %d)", res, get_win32_name (), get_handle ()); - /* GetFileInformationByHandle will fail if it's given stdio handle or pipe*/ + /* GetFileInformationByHandle will fail if it's given stdio handle or pipe. + It also fails on 9x when trying to access directories on shares. */ if (!res) { memset (&local, 0, sizeof (local)); local.nFileSizeLow = GetFileSize (get_handle (), &local.nFileSizeHigh); + /* Even GetFileSize fails on 9x when trying to access directories + on shares. In this case reset filesize to 0. */ + if (local.nFileSizeLow == 0xffffffff && GetLastError ()) + local.nFileSizeLow = 0; } return fstat_helper (buf, -- cgit v1.2.3