WS2_register_async_shutdown(): Try immediate completion, in case an

app never waits for anything.
WS_accept(): Avoid crash if addr parameter is NULL.
This commit is contained in:
Martin Wilck 2002-09-06 19:35:45 +00:00 committed by Alexandre Julliard
parent 40681ff2e8
commit 9dccb29447

View file

@ -1371,7 +1371,12 @@ static int WS2_register_async_shutdown ( SOCKET s, int fd, int type )
ws2_async_cleanup ( &wsa->async );
goto out;
}
return 0;
/* Try immediate completion */
if ( WSAGetOverlappedResult ( (HANDLE) s, ovl, NULL, FALSE, NULL ) )
return 0;
if ( (err = WSAGetLastError ()) == WSA_IO_INCOMPLETE )
return 0;
return WSAEINVAL;
out_close:
WSACloseEvent ( ovl->hEvent );
@ -1414,7 +1419,8 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr,
SERVER_END_REQ;
if (as)
{
WS_getpeername(as, addr, addrlen32);
if (addr)
WS_getpeername(as, addr, addrlen32);
return as;
}
}