Commit 17340728 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ws2_32: Set last error on success for SO_OPENTYPE.

parent e60f009d
......@@ -1578,12 +1578,13 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
case SO_OPENTYPE:
if (!optlen || *optlen < sizeof(int) || !optval)
{
SetLastError(WSAEFAULT);
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
*(int *)optval = get_per_thread_data()->opentype;
*optlen = sizeof(int);
TRACE("getting global SO_OPENTYPE = 0x%x\n", *((int*)optval) );
SetLastError( ERROR_SUCCESS );
return 0;
case SO_PROTOCOL_INFOA:
......@@ -2917,11 +2918,12 @@ int WINAPI setsockopt( SOCKET s, int level, int optname, const char *optval, int
case SO_OPENTYPE:
if (!optlen || optlen < sizeof(int) || !optval)
{
SetLastError(WSAEFAULT);
SetLastError( WSAEFAULT );
return SOCKET_ERROR;
}
get_per_thread_data()->opentype = *(const int *)optval;
TRACE("setting global SO_OPENTYPE = 0x%x\n", *((const int*)optval) );
SetLastError( ERROR_SUCCESS );
return 0;
case SO_RANDOMIZE_PORT:
......
......@@ -1177,6 +1177,7 @@ static void test_set_getsockopt(void)
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_DONTROUTE, TRUE, {1, 1, 1}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_RCVTIMEO, FALSE, {1, 2, 4}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_SNDTIMEO, FALSE, {1, 2, 4}, {0}, TRUE},
{AF_INET, SOCK_STREAM, SOL_SOCKET, SO_OPENTYPE, FALSE, {1, 2, 4}, {0}, TRUE},
{AF_INET, SOCK_DGRAM, IPPROTO_IP, IP_MULTICAST_LOOP, TRUE, {1, 1, 4}, {0}, TRUE, TRUE},
{AF_INET, SOCK_DGRAM, IPPROTO_IP, IP_MULTICAST_TTL, TRUE, {1, 1, 4}, {0}, FALSE},
{AF_INET, SOCK_DGRAM, IPPROTO_IP, IP_TOS, TRUE, {1, 1, 4}, {0}, FALSE},
......
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