[PATCH 1/2] ws2_32: Clear last error in WSASocketW

Alex Henrie alexhenrie24 at gmail.com
Mon Oct 18 00:45:28 CDT 2021


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ws2_32/socket.c     | 1 +
 dlls/ws2_32/tests/sock.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index b3dab22ae6e..50ea15c5b0e 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3363,6 +3363,7 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
         CloseHandle(handle);
         return INVALID_SOCKET;
     }
+    WSASetLastError(0);
     return ret;
 
 done:
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 2bb219d7c0e..eadc47a8ea6 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2418,7 +2418,7 @@ static void test_WSASocket(void)
     {
         SetLastError( 0xdeadbeef );
         sock = WSASocketA( tests[i].family, tests[i].type, tests[i].protocol, NULL, 0, 0 );
-        todo_wine_if (!tests[i].error || i == 7)
+        todo_wine_if (i == 7)
             ok(WSAGetLastError() == tests[i].error, "Test %u: got wrong error %u\n", i, WSAGetLastError());
         if (tests[i].error)
         {
-- 
2.33.1




More information about the wine-devel mailing list