ws2_32: Set last error on success for SO_OPENTYPE.

Signed-off-by: Paul Gofman <pgofman@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2022-03-09 11:59:44 +03:00 committed by Alexandre Julliard
parent e60f009dc7
commit 173407286e
2 changed files with 5 additions and 2 deletions

View File

@ -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:

View File

@ -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},