From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 2F6323854835; Fri, 19 Feb 2021 18:43:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F6323854835 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: fstat_helper: always use handle in call to get_file_attribute X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: e67679fcac44be77bd0be880e9a938b9f300f2dd X-Git-Newrev: 70f63608699321fed8e3501469e5a8a3c416186d Message-Id: <20210219184357.2F6323854835@sourceware.org> Date: Fri, 19 Feb 2021 18:43:57 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Feb 2021 18:43:57 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=70f63608699321fed8e3501469e5a8a3c416186d commit 70f63608699321fed8e3501469e5a8a3c416186d Author: Ken Brown Date: Wed Feb 10 21:15:20 2021 -0500 Cygwin: fstat_helper: always use handle in call to get_file_attribute Previously, the call to get_file_attribute for FIFOs set the first argument to NULL instead of the handle h returned by get_stat_handle, thereby forcing the file to be opened for fetching the security descriptor in get_file_sd(). This was done because h might have been a pipe handle rather than a file handle, and its permissions would not necessarily reflect those of the file. That situation can no longer occur with the new fhandler_fifo::fstat introduced in the previous commit. Diff: --- winsup/cygwin/fhandler_disk_file.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index ef9171bbf..6170427b0 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -475,8 +475,7 @@ fhandler_base::fstat_helper (struct stat *buf) else if (pc.issocket ()) buf->st_mode = S_IFSOCK; - if (!get_file_attribute (is_fs_special () && !pc.issocket () ? NULL : h, pc, - &buf->st_mode, &buf->st_uid, &buf->st_gid)) + if (!get_file_attribute (h, pc, &buf->st_mode, &buf->st_uid, &buf->st_gid)) { /* If read-only attribute is set, modify ntsec return value */ if (::has_attribute (attributes, FILE_ATTRIBUTE_READONLY)