summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2020-01-25 07:45:10 -0500
committerKen Brown <kbrown@cornell.edu>2020-01-30 09:43:19 -0500
commit23cb58af623c457639fdcf97c1990edda0508d5c (patch)
treed758955485065eb0c3d8139716729387d4abfb6c
parent141437d37440572b5452e941df3d4454f0c4378b (diff)
downloadcygnal-23cb58af623c457639fdcf97c1990edda0508d5c.tar.gz
cygnal-23cb58af623c457639fdcf97c1990edda0508d5c.tar.bz2
cygnal-23cb58af623c457639fdcf97c1990edda0508d5c.zip
Cygwin: AF_LOCAL::fstatvfs: use our handle if O_PATH is set
If O_PATH is set, then the fhandler_socket_local object has a handle that can be used for getting the statvfs information. Use it by calling fhandler_base::fstatvfs_by_handle. Without this change, fhandler_disk_file::fstatfvs would be called on a new fhandler_disk object, which would then have to be opened.
-rw-r--r--winsup/cygwin/fhandler_socket_local.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc
index e7f4fe603..76815a611 100644
--- a/winsup/cygwin/fhandler_socket_local.cc
+++ b/winsup/cygwin/fhandler_socket_local.cc
@@ -675,6 +675,13 @@ fhandler_socket_local::fstatvfs (struct statvfs *sfs)
{
if (get_sun_path () && get_sun_path ()[0] == '\0')
return fhandler_socket_wsock::fstatvfs (sfs);
+ if (get_flags () & O_PATH)
+ /* We already have a handle. */
+ {
+ HANDLE h = get_handle ();
+ if (h)
+ return fstatvfs_by_handle (h, sfs);
+ }
fhandler_disk_file fh (pc);
fh.get_device () = FH_FS;
return fh.fstatvfs (sfs);