diff options
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 9f0816bad..31c40296a 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -600,7 +600,14 @@ cygwin_connect (int fd, { res = connect (sock->get_socket (), (sockaddr *) &sin, namelen); if (res) - set_winsock_errno (); + { + /* Special handling for connect to return the correct error code + when called to early on a non-blocking socket. */ + if (WSAGetLastError () == WSAEWOULDBLOCK) + WSASetLastError (WSAEINPROGRESS); + + set_winsock_errno (); + } } return res; } |