Allow lookups to be performed without specifying a port number

This commit is contained in:
Pierre Pronchery 2014-04-25 18:22:08 +08:00
parent 79ade481a5
commit c7d21c3ebf

View File

@ -41,7 +41,10 @@ static int _init_address(Class * instance, char const * name, int domain,
return -error_set_code(1, "%s", strerror(errno)); return -error_set_code(1, "%s", strerror(errno));
/* obtain the port number */ /* obtain the port number */
if(p == NULL || (q = strrchr(p, sep)) == NULL) if(p == NULL || (q = strrchr(p, sep)) == NULL)
l = -error_set_code(1, "%s", strerror(EINVAL)); {
l = 0;
q = NULL;
}
else else
{ {
*(q++) = '\0'; *(q++) = '\0';