Treat blank protocol the same as NULL in getservbyname &

getservbyport.
This commit is contained in:
Paul Rupe 2003-03-17 04:42:11 +00:00 committed by Alexandre Julliard
parent a9c51cb60b
commit 42a9ca5765
1 changed files with 3 additions and 2 deletions

View File

@ -3158,7 +3158,7 @@ static WIN_servent* __ws_getservbyname(const char *name, const char *proto, int
if( i ) {
EnterCriticalSection( &csWSgetXXXbyYYY );
serv = getservbyname(local_buffer,
proto ? (local_buffer + i) : NULL);
proto && *proto ? (local_buffer + i) : NULL);
if( serv != NULL )
{
if( WS_dup_se(serv, dup_flag) )
@ -3207,7 +3207,8 @@ static WIN_servent* __ws_getservbyport(int port, const char* proto, int dup_flag
struct servent* serv;
if (!proto || wsi_strtolo( proto, NULL )) {
EnterCriticalSection( &csWSgetXXXbyYYY );
if( (serv = getservbyport(port, (proto) ? local_buffer : NULL)) != NULL ) {
if( (serv = getservbyport(port, proto && *proto ? local_buffer :
NULL)) != NULL ) {
if( WS_dup_se(serv, dup_flag) )
retval = se_buffer;
else SetLastError(WSAENOBUFS);