Allow specifying empty port numbers

This commit is contained in:
Pierre Pronchery 2014-04-25 19:14:20 +08:00
parent 93e8e13de2
commit 6eb9a47476

View File

@ -44,7 +44,8 @@ static struct addrinfo * _init_address(char const * name, int domain, int flags)
return NULL;
}
/* obtain the port number */
if(hostname == NULL || (servname = strrchr(hostname, sep)) == NULL)
if(hostname == NULL || (servname = strrchr(hostname, sep)) == NULL
|| servname[1] == '\0')
{
l = 0;
servname = NULL;