From 451ec9bb130666b94a5b597ba6eb7cc758f4e1e2 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Thu, 1 Apr 2021 10:56:04 -0400 Subject: [PATCH] Cygwin: AF_UNIX: listen_pipe: consider STATUS_PIPE_CLOSING NtFsControlFile(FSCTL_PIPE_LISTEN) can return STATUS_PIPE_CLOSING if a process has already connected to the pipe, written, and closed its handle. Treat this case the same as STATUS_SUCCESS. FIXME: We need to check more carefully that there isn't really an error condition. --- winsup/cygwin/fhandler_socket_unix.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index d283a7ede..1a0a7e7ba 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -1142,6 +1142,14 @@ fhandler_socket_unix::listen_pipe () set_errno (EINTR); else if (status == STATUS_PIPE_LISTENING) set_errno (EAGAIN); + else if (status == STATUS_PIPE_CLOSING) + { + /* FIXME: For now I'm assuming that someone connected, wrote, + and closed. But we should probably query the os to be sure, + as in fhandler_fifo.cc. */ + debug_printf ("STATUS_PIPE_CLOSING"); + ret = 0; + } else if (status == STATUS_SUCCESS || status == STATUS_PIPE_CONNECTED) ret = 0; else