* autoload.cc: Add autoload statement for `WSASetLastError'.

* net.cc (cygwin_connect): Change error code to WSAEINPROGRESS
        when connect returns WSAEWOULDBLOCK.
This commit is contained in:
Corinna Vinschen 2000-11-07 20:01:09 +00:00
parent 64ef9db779
commit 4c25744f86
3 changed files with 15 additions and 1 deletions

View File

@ -1,3 +1,9 @@
Tue Nov 7 20:58:00 2000 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc: Add autoload statement for `WSASetLastError'.
* net.cc (cygwin_connect): Change error code to WSAEINPROGRESS
when connect returns WSAEWOULDBLOCK.
Mon Nov 6 15:11:57 2000 Christopher Faylor <cgf@cygnus.com> Mon Nov 6 15:11:57 2000 Christopher Faylor <cgf@cygnus.com>
* dcrt0.cc (sigthread::init): Reinstitute sigthread lock as a critical * dcrt0.cc (sigthread::init): Reinstitute sigthread lock as a critical

View File

@ -275,6 +275,7 @@ LoadDLLinit (wsock32)
LoadDLLfunc (WSAAsyncSelect, 16, wsock32) LoadDLLfunc (WSAAsyncSelect, 16, wsock32)
LoadDLLfunc (WSACleanup, 0, wsock32) LoadDLLfunc (WSACleanup, 0, wsock32)
LoadDLLfunc (WSAGetLastError, 0, wsock32) LoadDLLfunc (WSAGetLastError, 0, wsock32)
LoadDLLfunc (WSASetLastError, 4, wsock32)
LoadDLLfunc (WSAStartup, 8, wsock32) LoadDLLfunc (WSAStartup, 8, wsock32)
LoadDLLfunc (__WSAFDIsSet, 8, wsock32) LoadDLLfunc (__WSAFDIsSet, 8, wsock32)
LoadDLLfunc (accept, 12, wsock32) LoadDLLfunc (accept, 12, wsock32)

View File

@ -600,7 +600,14 @@ cygwin_connect (int fd,
{ {
res = connect (sock->get_socket (), (sockaddr *) &sin, namelen); res = connect (sock->get_socket (), (sockaddr *) &sin, namelen);
if (res) 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; return res;
} }