From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 476 invoked by alias); 28 Jan 2020 19:06:53 -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 461 invoked by uid 9996); 28 Jan 2020 19:06:53 -0000 Date: Tue, 28 Jan 2020 19:06:00 -0000 Message-ID: <20200128190653.460.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: FIFO: 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: 68b7a457f7331ed852380cd7afd0e17dffdc726e X-Git-Newrev: 13d75fce48436e4f15bf97b4d2145078888994b0 X-SW-Source: 2020-q1/txt/msg00041.txt https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=13d75fce48436e4f15bf97b4d2145078888994b0 commit 13d75fce48436e4f15bf97b4d2145078888994b0 Author: Ken Brown 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);