Bruno Jesus : ws2_32/tests: Avoid crashing if getservbyname fails.

Alexandre Julliard julliard at winehq.org
Wed Apr 11 12:56:48 CDT 2012


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

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Tue Apr 10 23:25:56 2012 -0300

ws2_32/tests: Avoid crashing if getservbyname fails.

---

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

diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 9fd6abb..f3b33be 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -1600,6 +1600,7 @@ static DWORD WINAPI do_getservbyname( void *param )
         for ( j = 0; j < 2; j++ ) {
             pserv[j] = getservbyname ( serv[j].name, serv[j].proto );
             ok ( pserv[j] != NULL, "getservbyname could not retrieve information for %s: %d\n", serv[j].name, WSAGetLastError() );
+            if ( !pserv[j] ) continue;
             ok ( pserv[j]->s_port == htons(serv[j].port), "getservbyname returned the wrong port for %s: %d\n", serv[j].name, ntohs(pserv[j]->s_port) );
             ok ( !strcmp ( pserv[j]->s_proto, serv[j].proto ), "getservbyname returned the wrong protocol for %s: %s\n", serv[j].name, pserv[j]->s_proto );
             ok ( !strcmp ( pserv[j]->s_name, serv[j].name ), "getservbyname returned the wrong name for %s: %s\n", serv[j].name, pserv[j]->s_name );




More information about the wine-cvs mailing list