From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31863 invoked by alias); 24 Jan 2020 10:27:03 -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 31845 invoked by uid 9078); 24 Jan 2020 10:27:03 -0000 Date: Fri, 24 Jan 2020 10:27:00 -0000 Message-ID: <20200124102703.31844.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: FIFO: tweak fcntl and dup when O_PATH is set X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 5fb3790422495ba55390bbac32b60bcea908ef70 X-Git-Newrev: 7d68ffadd3fbc9b8dcd189d4a20c12a9cd1ed743 X-SW-Source: 2020-q1/txt/msg00031.txt https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=7d68ffadd3fbc9b8dcd189d4a20c12a9cd1ed743 commit 7d68ffadd3fbc9b8dcd189d4a20c12a9cd1ed743 Author: Ken Brown Date: Thu Jan 23 16:31:05 2020 +0000 Cygwin: FIFO: tweak fcntl and dup when O_PATH is set fhandler_fifo::fcntl and fhandler_fifo::dup now call the corresponding fhandler_base methods if the FIFO was opened with the O_PATH flag. Diff: --- winsup/cygwin/fhandler_fifo.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 8cbab35..a338f12 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -997,7 +997,7 @@ fhandler_fifo::close () int fhandler_fifo::fcntl (int cmd, intptr_t arg) { - if (cmd != F_SETFL || nohandle ()) + if (cmd != F_SETFL || nohandle () || (get_flags () & O_PATH)) return fhandler_base::fcntl (cmd, arg); const bool was_nonblocking = is_nonblocking (); @@ -1014,6 +1014,9 @@ fhandler_fifo::dup (fhandler_base *child, int flags) int ret = -1; fhandler_fifo *fhf = NULL; + if (get_flags () & O_PATH) + return fhandler_base::dup (child, flags); + if (fhandler_base::dup (child, flags)) goto out;