Bruno Jesus : ws2_32/tests: Fix bad usage of WSAGetLastError() in tests.

Alexandre Julliard julliard at winehq.org
Thu Aug 1 14:25:45 CDT 2013


Module: wine
Branch: master
Commit: d7f216818f10077599dc17a5e2a43ca0f7d520a5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d7f216818f10077599dc17a5e2a43ca0f7d520a5

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Wed Jul 31 18:32:26 2013 -0300

ws2_32/tests: Fix bad usage of WSAGetLastError() in tests.

---

 dlls/ws2_32/tests/sock.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 1a75ffd..2ee81ae 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1766,8 +1766,8 @@ todo_wine
 todo_wine {
     size = sizeof(socktype);
     socktype = 0xdead;
-    ok(!getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size), "getsockopt failed with %d\n",
-       WSAGetLastError());
+    err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
+    ok(!err, "getsockopt failed with %d\n", WSAGetLastError());
     ok(socktype == pi[0].iSocketType, "Wrong socket type, expected %d received %d\n",
        pi[0].iSocketType, socktype);
 }
@@ -1783,9 +1783,9 @@ todo_wine
 
         size = sizeof(socktype);
         socktype = 0xdead;
+        err = getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size);
 todo_wine
-        ok(!getsockopt(sock, SOL_SOCKET, SO_TYPE, (char *) &socktype, &size), "getsockopt failed with %d\n",
-           WSAGetLastError());
+        ok(!err, "getsockopt failed with %d\n", WSAGetLastError());
 
         for (j = 0; j < items; j++)
         {
@@ -2508,14 +2508,16 @@ static void test_listen(void)
     ok (ret == WSAEINVAL, "expected 10022, received %d\n", ret);
 
     acceptc = 0xdead;
-    ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n");
+    ret = getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen);
+    ok (!ret, "getsockopt failed\n");
     ok (acceptc == 0, "SO_ACCEPTCONN should be 0, received %d\n", acceptc);
 
     ok (!listen(fdA, 0), "listen failed\n");
     ok (!listen(fdA, SOMAXCONN), "double listen failed\n");
 
     acceptc = 0xdead;
-    ok (!getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen), "getsockopt failed\n");
+    ret = getsockopt(fdA, SOL_SOCKET, SO_ACCEPTCONN, (char*)&acceptc, &olen);
+    ok (!ret, "getsockopt failed\n");
     ok (acceptc == 1, "SO_ACCEPTCONN should be 1, received %d\n", acceptc);
 
     SetLastError(0xdeadbeef);




More information about the wine-cvs mailing list