[2/2] ws2_32/tests: test why to negate return value of SIOCATMARK

André Hentschel nerv at dawncrow.de
Wed Nov 4 13:31:34 CST 2009


The Kernel ioctl returns TRUE if the actual socket data is urgent and FALSE if it is not.
Windows ioctl returns TRUE if it is not and FALSE if it is urgent.
So Wine has to negate the value.
---
 dlls/ws2_32/tests/sock.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 518ab4a..933c86e 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -2453,6 +2453,7 @@ static void test_ioctlsocket(void)
     int ret;
     static const LONG cmds[] = {FIONBIO, FIONREAD, SIOCATMARK};
     UINT i;
+    u_long arg = 0;
 
     sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     ok(sock != INVALID_SOCKET, "Creating the socket failed: %d\n", WSAGetLastError());
@@ -2470,6 +2471,13 @@ static void test_ioctlsocket(void)
         ret = WSAGetLastError();
         ok(ret == WSAEFAULT, "expected WSAEFAULT, got %d instead\n", ret);
     }
+
+    /* A fresh and not connected socket has no urgent data, this test shows
+     * that normal(not urgent) data returns a non-zero value for SIOCATMARK. */
+
+    ret = ioctlsocket(sock, SIOCATMARK, &arg);
+    if(ret != SOCKET_ERROR)
+        ok(arg, "expected a non-zero value\n");
 }
 
 static int drain_pause=0;
-- 

Best Regards, André Hentschel



More information about the wine-patches mailing list