Commit 3b2fcdd4 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32/tests: Avoid crashing if getservbyname fails.

parent d2096970
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment