Commit 1d7d5732 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Implement getsockopt(SO_DONTLINGER) on top of Win32 getsockopt(SO_LINGER).

parent 130b5496
...@@ -2162,29 +2162,21 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, ...@@ -2162,29 +2162,21 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
case WS_SO_DONTLINGER: case WS_SO_DONTLINGER:
{ {
struct linger lingval; struct WS_linger linger;
socklen_t len = sizeof(struct linger); int len = sizeof(linger);
int ret;
if (!optlen || *optlen < sizeof(BOOL)|| !optval) if (!optlen || *optlen < sizeof(BOOL)|| !optval)
{ {
SetLastError(WSAEFAULT); SetLastError(WSAEFAULT);
return SOCKET_ERROR; return SOCKET_ERROR;
} }
if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
return SOCKET_ERROR;
if (getsockopt(fd, SOL_SOCKET, SO_LINGER, &lingval, &len) != 0 ) if (!(ret = WS_getsockopt( s, WS_SOL_SOCKET, WS_SO_LINGER, (char *)&linger, &len )))
{ {
SetLastError(wsaErrno()); *(BOOL *)optval = !linger.l_onoff;
ret = SOCKET_ERROR;
}
else
{
*(BOOL *)optval = !lingval.l_onoff;
*optlen = sizeof(BOOL); *optlen = sizeof(BOOL);
} }
release_sock_fd( s, fd );
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment