From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43329 invoked by alias); 30 Jan 2020 14:44:41 -0000 Mailing-List: contact cygwin-cvs-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-cvs-owner@cygwin.com Received: (qmail 43311 invoked by uid 9996); 30 Jan 2020 14:44:40 -0000 Date: Thu, 30 Jan 2020 14:44:00 -0000 Message-ID: <20200130144440.43310.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: AF_LOCAL::fstatvfs: use our handle if O_PATH is set X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 141437d37440572b5452e941df3d4454f0c4378b X-Git-Newrev: 23cb58af623c457639fdcf97c1990edda0508d5c X-SW-Source: 2020-q1/txt/msg00047.txt https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=23cb58af623c457639fdcf97c1990edda0508d5c commit 23cb58af623c457639fdcf97c1990edda0508d5c Author: Ken Brown 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);