ws2_32/tests/sock.c -- fix error checking (RESEND)

Gerald Pfeifer gerald at pfeifer.com
Tue Nov 13 14:03:33 CST 2007


I haven't seen a response to this and about a dozen other patches 
along these lines I sent around ten days ago whereas the tree has
been pretty active.

Is there any particular reason?  Should I resend those patches?

Gerald

---------- Forwarded message ----------
From: Gerald Pfeifer <gerald at pfeifer.com>
To:  <wine-patches at winehq.org>
Date: Sat, 3 Nov 2007 18:45:39 +0100 (CET)
Subject: ws2_32/tests/sock.c -- fix error checking

Another real example where my quest to address warnings uncovered a
real bug.  In all those three cases the error handling simply didn't
take place because the condition wasn't able to trigger.

Gerald

ChangeLog:
Fix error checking in test_extendedSocketOptions() and test_getsockname().

Index: dlls/ws2_32/tests/sock.c
===================================================================
RCS file: /home/wine/wine/dlls/ws2_32/tests/sock.c,v
retrieving revision 1.19
diff -u -3 -p -r1.19 sock.c
--- dlls/ws2_32/tests/sock.c	25 Sep 2007 12:52:33 -0000	1.19
+++ dlls/ws2_32/tests/sock.c	3 Nov 2007 17:38:11 -0000
@@ -1638,7 +1638,7 @@ static void test_extendedSocketOptions(v
     sa.sin_port = htons(0);
     sa.sin_addr.s_addr = htonl(INADDR_ANY);
 
-    if((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0){
+    if((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) == INVALID_SOCKET) {
         trace("Creating the socket failed: %d\n", WSAGetLastError());
         WSACleanup();
         return;
@@ -1664,7 +1664,7 @@ static void test_extendedSocketOptions(v
 
     closesocket(sock);
 
-    if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) < 0){
+    if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) == INVALID_SOCKET) {
         trace("Creating the socket failed: %d\n", WSAGetLastError());
         WSACleanup();
         return;
@@ -1711,7 +1711,7 @@ static void test_getsockname(void)
     sa_set.sin_port = htons(0);
     sa_set.sin_addr.s_addr = htonl(INADDR_ANY);
 
-    if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) < 0){
+    if((sock = socket(PF_INET, SOCK_STREAM, IPPROTO_IP)) == INVALID_SOCKET) {
         trace("Creating the socket failed: %d\n", WSAGetLastError());
         WSACleanup();
         return;



More information about the wine-patches mailing list