Paul Gofman : ws2_32: Set last error on success for SO_OPENTYPE.
Alexandre Julliard
julliard at winehq.org
Wed Mar 9 16:08:45 CST 2022
Module: wine
Branch: master
Commit: 173407286efae4ab09a04f965d7a8623b8882b12
URL: https://source.winehq.org/git/wine.git/?a=commit;h=173407286efae4ab09a04f965d7a8623b8882b12
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Wed Mar 9 11:59:44 2022 +0300
ws2_32: Set last error on success for SO_OPENTYPE.
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ws2_32/socket.c | 6 ++++--
dlls/ws2_32/tests/sock.c | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 85387f08c59..f440d7b0abd 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -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:
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 104129189e4..7d0fd60522f 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -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},
More information about the wine-cvs
mailing list