From aa55d22cb55d67d7f77ee9d58f9016c42c3ee495 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Thu, 27 Jun 2019 07:46:14 -0400 Subject: [PATCH] Cygwin: honor the O_PATH flag when opening a FIFO Previously fhandler_fifo::open would treat the FIFO as a reader and would block, waiting for a writer. --- winsup/cygwin/fhandler_fifo.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 737264b85..92797ce60 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -451,11 +451,18 @@ fhandler_fifo::open (int flags, mode_t) error_set_errno } res; + if (flags & O_PATH) + { + query_open (query_read_attributes); + nohandle (true); + } + /* Determine what we're doing with this fhandler: reading, writing, both */ switch (flags & O_ACCMODE) { case O_RDONLY: - reader = true; + if (!query_open ()) + reader = true; break; case O_WRONLY: writer = true; @@ -577,6 +584,8 @@ fhandler_fifo::open (int flags, mode_t) } } } + if (query_open ()) + res = success; out: if (res == error_set_errno) __seterrno ();