summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_disk_file.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2004-03-23 11:26:54 +0000
committerCorinna Vinschen <corinna@vinschen.de>2004-03-23 11:26:54 +0000
commit88506c6752eee9d8de05d375972fef4f19c06640 (patch)
tree530fe75433f14162643db4fc969f26b5679aade5 /winsup/cygwin/fhandler_disk_file.cc
parent6653af6cc2d118f50dc8b7a37ba24d9bb9865ef6 (diff)
downloadcygnal-88506c6752eee9d8de05d375972fef4f19c06640.tar.gz
cygnal-88506c6752eee9d8de05d375972fef4f19c06640.tar.bz2
cygnal-88506c6752eee9d8de05d375972fef4f19c06640.zip
* fhandler_disk_file.cc (fhandler_base::fstat_fs): Use created
handle regardless of nohandle state. Clean up afterwards.
Diffstat (limited to 'winsup/cygwin/fhandler_disk_file.cc')
-rw-r--r--winsup/cygwin/fhandler_disk_file.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
index fb707163e..8661445a1 100644
--- a/winsup/cygwin/fhandler_disk_file.cc
+++ b/winsup/cygwin/fhandler_disk_file.cc
@@ -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;
}