summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2020-01-24 15:09:03 -0500
committerKen Brown <kbrown@cornell.edu>2020-01-28 14:05:13 -0500
commit13d75fce48436e4f15bf97b4d2145078888994b0 (patch)
tree71af6a2febb09c1f9a798137a5ca2c6036545083
parent68b7a457f7331ed852380cd7afd0e17dffdc726e (diff)
downloadcygnal-13d75fce48436e4f15bf97b4d2145078888994b0.tar.gz
cygnal-13d75fce48436e4f15bf97b4d2145078888994b0.tar.bz2
cygnal-13d75fce48436e4f15bf97b4d2145078888994b0.zip
Cygwin: FIFO: fstatvfs: use our handle if O_PATH is set
If O_PATH is set, then the fhandler_fifo object has a handle that can be used for getting the statvfs information. Use it by calling fhandler_base::fstatvfs_by_handle. Before this change, fhandler_disk_file::fstatfvs was called on a new fhandler_disk_file object, which would then have to be opened.
-rw-r--r--winsup/cygwin/fhandler_fifo.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index a338f12cc..ef568f6fe 100644
--- a/winsup/cygwin/fhandler_fifo.cc
+++ b/winsup/cygwin/fhandler_fifo.cc
@@ -906,6 +906,14 @@ errout:
int __reg2
fhandler_fifo::fstatvfs (struct statvfs *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);