public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Ken Brown <kbrown@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: AF_LOCAL::fstatvfs: use our handle if O_PATH is set
Date: Thu, 30 Jan 2020 14:44:00 -0000	[thread overview]
Message-ID: <20200130144440.43310.qmail@sourceware.org> (raw)

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

commit 23cb58af623c457639fdcf97c1990edda0508d5c
Author: Ken Brown <kbrown@cornell.edu>
Date:   Sat Jan 25 07:45:10 2020 -0500

    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.

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

diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc
index e7f4fe6..76815a6 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);


                 reply	other threads:[~2020-01-30 14:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130144440.43310.qmail@sourceware.org \
    --to=kbrown@sourceware.org \
    --cc=cygwin-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).