public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: honor the O_PATH flag when opening a FIFO
@ 2019-06-27 12:12 Ken Brown
  0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2019-06-27 12:12 UTC (permalink / raw)
  To: cygwin-cvs

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

commit aa55d22cb55d67d7f77ee9d58f9016c42c3ee495
Author: Ken Brown <kbrown@cornell.edu>
Date:   Thu Jun 27 07:46:14 2019 -0400

    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.

Diff:
---
 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 737264b..92797ce 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 ();


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-27 12:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 12:12 [newlib-cygwin] Cygwin: honor the O_PATH flag when opening a FIFO Ken Brown

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).