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: fstat_helper: always use handle in call to get_file_attribute
Date: Fri, 19 Feb 2021 18:43:57 +0000 (GMT)	[thread overview]
Message-ID: <20210219184357.2F6323854835@sourceware.org> (raw)

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

commit 70f63608699321fed8e3501469e5a8a3c416186d
Author: Ken Brown <kbrown@cornell.edu>
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)


             reply	other threads:[~2021-02-19 18:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 18:43 Ken Brown [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-01-31 12:45 Ken Brown

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=20210219184357.2F6323854835@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).