- port = strtoul(serv, &z, 0);
+ if (!*serv) return EAI_SERVICE;
+ port = strtoul(serv, &z, 10);
/* Try as a numeric address */
if (__ipparse(&sa, family, host) >= 0) {
buf = calloc(sizeof *buf, 1+EXTRA);
/* Try as a numeric address */
if (__ipparse(&sa, family, host) >= 0) {
buf = calloc(sizeof *buf, 1+EXTRA);
buf->ai.ai_addr = (void *)&buf->sa;
buf->ai.ai_addrlen = family==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin;
buf->ai.ai_family = family;
buf->ai.ai_addr = (void *)&buf->sa;
buf->ai.ai_addrlen = family==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin;
buf->ai.ai_family = family;