ws2_32/tests: Avoid crashing if getservbyname fails.

This commit is contained in:
Bruno Jesus 2012-04-10 23:25:56 -03:00 committed by Alexandre Julliard
parent d209697073
commit 3b2fcdd426
1 changed files with 1 additions and 0 deletions

View File

@ -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 );