OSDN Git Service

* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use created
authorcorinna <corinna>
Tue, 23 Mar 2004 11:26:53 +0000 (11:26 +0000)
committercorinna <corinna>
Tue, 23 Mar 2004 11:26:53 +0000 (11:26 +0000)
handle regardless of nohandle state.  Clean up afterwards.

winsup/cygwin/ChangeLog
winsup/cygwin/fhandler_disk_file.cc

index 2db737c..b0f990c 100644 (file)
@@ -1,3 +1,8 @@
+2004-03-23  Corinna Vinschen  <corinna@vinschen.de>
+
+       * fhandler_disk_file.cc (fhandler_base::fstat_fs): Use created
+       handle regardless of nohandle state.  Clean up afterwards.
+
 2004-03-23  Gerd Spalink  <Gerd.Spalink@t-online.de>
 
        * autoload.cc: Load eight more functions for waveIn support.
index fb70716..8661445 100644 (file)
@@ -201,13 +201,21 @@ fhandler_base::fstat_fs (struct __stat64 *buf)
       oret = open_fs (open_flags, 0);
     }
 
-  if (!oret || get_nohandle ())
-    res = fstat_by_name (buf);
-  else
+  if (oret)
     {
+      /* We now have a valid handle, regardless of the "nohandle" state.
+         Since fhandler_base::open only calls CloseHandle if !get_nohandle,
+        we have to set it to false before calling close_fs and restore
+        the state afterwards. */
       res = fstat_by_handle (buf);
+      bool nohandle = get_nohandle ();
+      set_nohandle (false);
       close_fs ();
+      set_nohandle (nohandle);
+      set_io_handle (NULL);
     }
+  else
+    res = fstat_by_name (buf);
 
   return res;
 }