ws2_32: Fix SO_ACCEPTCONN on BSD systems.

This commit is contained in:
Bruno Jesus 2013-09-06 09:14:00 -03:00 committed by Alexandre Julliard
parent 0b03dc93e9
commit b2170d845d
1 changed files with 13 additions and 1 deletions

View File

@ -2855,7 +2855,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
{
/* Handle common cases. The special cases are below, sorted
* alphabetically */
case WS_SO_ACCEPTCONN:
case WS_SO_BROADCAST:
case WS_SO_DEBUG:
case WS_SO_ERROR:
@ -2875,7 +2874,20 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
}
release_sock_fd( s, fd );
return ret;
case WS_SO_ACCEPTCONN:
if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
return SOCKET_ERROR;
if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, optval, (socklen_t *)optlen) != 0 )
{
SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
ret = SOCKET_ERROR;
}
/* BSD returns != 0 while Windows return exact == 1 */
if (*(int *)optval) *(int *)optval = 1;
release_sock_fd( s, fd );
return ret;
case WS_SO_DONTLINGER:
{
struct linger lingval;