diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2001-09-05 12:16:51 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2001-09-05 12:16:51 +0400 |
commit | 47497e62435513c9a32f8c511118a58357db63ed (patch) | |
tree | c88af64dab0248b3c8cad581cfec5ab732a0c793 /winsup/cygwin/net.cc | |
parent | 0bcb0f6a0e6c9981a9ea7be32ba898dbd563cf53 (diff) |
* net.cc (cygwin_connect): Add WSAEALREADY and WSAEINVAL handling
for non-blocking sockets.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r-- | winsup/cygwin/net.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 7077220bc..1715b16cb 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -868,13 +868,18 @@ cygwin_connect (int fd, if (res) { /* Special handling for connect to return the correct error code - when called to early on a non-blocking socket. */ - if (WSAGetLastError () == WSAEWOULDBLOCK) + when called on a non-blocking socket. */ + if (sock->is_nonblocking ()) { - WSASetLastError (WSAEINPROGRESS); - in_progress = TRUE; + DWORD err = WSAGetLastError (); + if (err == WSAEWOULDBLOCK || err == WSAEALREADY) + { + WSASetLastError (WSAEINPROGRESS); + in_progress = TRUE; + } + else if (err == WSAEINVAL) + WSASetLastError (WSAEISCONN); } - set_winsock_errno (); } if (sock->get_addr_family () == AF_UNIX) |