From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30270 invoked by alias); 24 Jan 2020 10:26: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 30255 invoked by uid 9078); 24 Jan 2020 10:26:52 -0000 Date: Fri, 24 Jan 2020 10:26:00 -0000 Message-ID: <20200124102652.30254.qmail@sourceware.org> Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: device_access_denied: return false if O_PATH is set X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 71091d165fe62f258a6dc9c61eba9f05d04acc69 X-Git-Newrev: d880e97ec95ac3b15be972a99da2a5e97ef63ee6 X-SW-Source: 2020-q1/txt/msg00029.txt https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=d880e97ec95ac3b15be972a99da2a5e97ef63ee6 commit d880e97ec95ac3b15be972a99da2a5e97ef63ee6 Author: Ken Brown 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))