The second patch in this series enables opening a FIFO with O_RDWR access. The underlying Windows named pipe is creted with duplex access, and its handle is made the I/O handle of the first client.
While testing this, I had some mysterious crashes, which are fixed by the first patch. I tested the patch in two ways. First, I went back to Kerrisk's server/client programs cited in https://cygwin.com/ml/cygwin/2015-03/msg00047.html. The server program opens a FIFO twice, once with O_RDONLY access and once with O_WRONLY access. The fd from the second call is never used; the purpose of that call is simply to make sure that attempts to read from the FIFO will never indicate EOF. I removed the second call and instead opened the FIFO only once, with O_RDWR access. The server/client programs still worked as expected. The second test was the following sequence of commands in a bash shell: $ mkfifo foo $ exec 7<>foo $ echo blah > foo $ read bar <&7 $ echo $bar blah Ken Ken Brown (2): Cygwin: FIFO: avoid crashes when cloning a client Cygwin: FIFO: add support for the duplex case winsup/cygwin/fhandler.h | 7 ++- winsup/cygwin/fhandler_fifo.cc | 79 +++++++++++++++++++++++++++++----- 2 files changed, 74 insertions(+), 12 deletions(-) -- 2.17.0