From 279591d91a13616957964256e02344a627b6f558 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Thu, 26 Mar 2020 19:02:16 -0400 Subject: [PATCH] Cygwin: FIFO: make read_ready a manual-reset event If a FIFO is open for reading and an attempt is made to open it for writing with O_NONBLOCK, read_ready must be set in order for open to succeed. When read_ready was an auto-reset event, there was a brief period when read_ready was not set set after a writer opened. If a second writer attempted to open the FIFO with O_NONBLOCK during this period, the attempt would fail. Addresses: https://sourceware.org/pipermail/cygwin/2020-March/244201.html --- winsup/cygwin/fhandler_fifo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 19cd0e507..c05161099 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -516,7 +516,7 @@ fhandler_fifo::open (int flags, mode_t) char npbuf[MAX_PATH]; __small_sprintf (npbuf, "r-event.%08x.%016X", get_dev (), get_ino ()); - if (!(read_ready = CreateEvent (sa_buf, false, false, npbuf))) + if (!(read_ready = CreateEvent (sa_buf, true, false, npbuf))) { debug_printf ("CreateEvent for %s failed, %E", npbuf); res = error_set_errno; -- 2.21.0