public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: FIFO: fstatvfs: use our handle if O_PATH is set
@ 2020-01-28 19:06 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2020-01-28 19:06 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=13d75fce48436e4f15bf97b4d2145078888994b0

commit 13d75fce48436e4f15bf97b4d2145078888994b0
Author: Ken Brown <kbrown@cornell.edu>
Date:   Fri Jan 24 15:09:03 2020 -0500

    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.

Diff:
---
 winsup/cygwin/fhandler_fifo.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc
index a338f12..ef568f6 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-01-28 19:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-28 19:06 [newlib-cygwin] Cygwin: FIFO: fstatvfs: use our handle if O_PATH is set Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).