ws2_32/tests: Avoid crashing if getservbyname fails.
This commit is contained in:
parent
d209697073
commit
3b2fcdd426
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue