ws2_32: Fix SO_ACCEPTCONN on BSD systems.
This commit is contained in:
parent
0b03dc93e9
commit
b2170d845d
|
@ -2855,7 +2855,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
|
||||||
{
|
{
|
||||||
/* Handle common cases. The special cases are below, sorted
|
/* Handle common cases. The special cases are below, sorted
|
||||||
* alphabetically */
|
* alphabetically */
|
||||||
case WS_SO_ACCEPTCONN:
|
|
||||||
case WS_SO_BROADCAST:
|
case WS_SO_BROADCAST:
|
||||||
case WS_SO_DEBUG:
|
case WS_SO_DEBUG:
|
||||||
case WS_SO_ERROR:
|
case WS_SO_ERROR:
|
||||||
|
@ -2875,7 +2874,20 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
|
||||||
}
|
}
|
||||||
release_sock_fd( s, fd );
|
release_sock_fd( s, fd );
|
||||||
return ret;
|
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:
|
case WS_SO_DONTLINGER:
|
||||||
{
|
{
|
||||||
struct linger lingval;
|
struct linger lingval;
|
||||||
|
|
Loading…
Reference in New Issue