public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: cygwin-cvs@sourceware.org
Subject: [newlib-cygwin] Cygwin: device_access_denied: return false if O_PATH is set
Date: Fri, 24 Jan 2020 10:26:00 -0000	[thread overview]
Message-ID: <20200124102652.30254.qmail@sourceware.org> (raw)

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

commit d880e97ec95ac3b15be972a99da2a5e97ef63ee6
Author: Ken Brown <kbrown@cornell.edu>
Date:   Thu Jan 23 16:31:04 2020 +0000

    Cygwin: device_access_denied: return false if O_PATH is set
    
    If O_PATH is set in the flags argument of
    fhandler_base::device_access_denied, return false.  No
    read/write/execute access should be required in this case.
    
    Previously, the call to device_access_denied in open(2) would lead to
    an attempt to open the file with read access even if the O_PATH flag
    was set.

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

diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc
index b0c9c50..aeee8fe 100644
--- a/winsup/cygwin/fhandler.cc
+++ b/winsup/cygwin/fhandler.cc
@@ -335,6 +335,9 @@ fhandler_base::device_access_denied (int flags)
 {
   int mode = 0;
 
+  if (flags & O_PATH)
+    return false;
+
   if (flags & O_RDWR)
     mode |= R_OK | W_OK;
   if (flags & (O_WRONLY | O_APPEND))


                 reply	other threads:[~2020-01-24 10:26 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=20200124102652.30254.qmail@sourceware.org \
    --to=corinna@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).