public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Ken Brown <kbrown@cornell.edu>
To: cygwin-patches@cygwin.com
Subject: [PATCH v2 5/6] Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS
Date: Sun,  4 Oct 2020 12:49:47 -0400	[thread overview]
Message-ID: <20201004164948.48649-6-kbrown@cornell.edu> (raw)
In-Reply-To: <20201004164948.48649-1-kbrown@cornell.edu>

A successful connection can be indicated by STATUS_SUCCESS or
STATUS_PIPE_CONNECTED.  Previously we were checking only for the
latter.
---
 winsup/cygwin/fhandler_socket_unix.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc
index 0ae7fe125..1a9532fe5 100644
--- a/winsup/cygwin/fhandler_socket_unix.cc
+++ b/winsup/cygwin/fhandler_socket_unix.cc
@@ -1064,6 +1064,7 @@ fhandler_socket_unix::listen_pipe ()
   IO_STATUS_BLOCK io;
   HANDLE evt = NULL;
   DWORD waitret = WAIT_OBJECT_0;
+  int ret = -1;
 
   io.Status = STATUS_PENDING;
   if (!is_nonblocking () && !(evt = create_event ()))
@@ -1085,9 +1086,11 @@ fhandler_socket_unix::listen_pipe ()
     set_errno (EINTR);
   else if (status == STATUS_PIPE_LISTENING)
     set_errno (EAGAIN);
-  else if (status != STATUS_PIPE_CONNECTED)
+  else if (status == STATUS_SUCCESS || status == STATUS_PIPE_CONNECTED)
+    ret = 0;
+  else
     __seterrno_from_nt_status (status);
-  return (status == STATUS_PIPE_CONNECTED) ? 0 : -1;
+  return ret;
 }
 
 ULONG
-- 
2.28.0


  parent reply	other threads:[~2020-10-04 16:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 16:49 [PATCH v2 0/6] Some AF_UNIX fixes Ken Brown
2020-10-04 16:49 ` [PATCH v2 1/6] Cygwin: AF_UNIX: use FILE_OPEN_REPARSE_POINT when needed Ken Brown
2020-10-04 16:49 ` [PATCH v2 2/6] Cygwin: fix handling of known reparse points that are not symlinks Ken Brown
2020-10-04 16:49 ` [PATCH v2 3/6] Cygwin: always recognize AF_UNIX sockets as reparse points Ken Brown
2020-10-04 16:49 ` [PATCH v2 4/6] Cygwin: AF_UNIX: socket: set the O_RDWR flag Ken Brown
2020-10-04 16:49 ` Ken Brown [this message]
2020-10-13 11:28   ` [PATCH v2 5/6] Cygwin: AF_UNIX: listen_pipe: check for STATUS_SUCCESS Corinna Vinschen
2020-10-13 13:18     ` Ken Brown
2020-10-13 15:31       ` Corinna Vinschen
2020-10-04 16:49 ` [PATCH v2 6/6] Cygwin: AF_UNIX: open_pipe: call recv_peer_info Ken Brown
2020-10-08 21:36 ` [PATCH v2 0/6] Some AF_UNIX fixes Ken Brown
2020-10-13 11:49   ` Corinna Vinschen
2020-10-14 16:39     ` Ken Brown
2020-10-15  4:19       ` Mark Geisert
2020-10-15  5:48         ` Brian Inglis
2020-10-15  8:16       ` Corinna Vinschen
2020-10-13 11:02 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201004164948.48649-6-kbrown@cornell.edu \
    --to=kbrown@cornell.edu \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).