X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/9456434688a271d2842431530108d7a13df96aac..d3f5c628d7bdec6f7334bbae68a7bee1f5285815:/lib/getaddrinfo.c diff --git a/lib/getaddrinfo.c b/lib/getaddrinfo.c index 838e7086..96d7a2ba 100644 --- a/lib/getaddrinfo.c +++ b/lib/getaddrinfo.c @@ -113,7 +113,7 @@ static char *get_canon_name_from_addr(struct in_addr ip, int *perr) { return canon_name_from_hostent( - gethostbyaddr(&ip, sizeof(ip), AF_INET), + gethostbyaddr((void *)&ip, sizeof ip, AF_INET), perr); } @@ -295,9 +295,8 @@ int getaddrinfo(const char *node, res); } else if (hints.ai_flags & AI_NUMERICHOST) { struct in_addr ip; - if (!inet_aton(node, &ip)) { + if (inet_pton(AF_INET, node, &ip) <= 0) return EAI_FAIL; - } return getaddr_info_single_addr(service, ntohl(ip.s_addr), &hints, @@ -492,13 +491,10 @@ int getnameinfo(const struct sockaddr *sa, socklen_t salen, return EAI_FAIL; } - /* We don't support those. */ - if ((node && !(flags & NI_NUMERICHOST)) - || (service && !(flags & NI_NUMERICSERV))) - return EAI_FAIL; - if (node) { - return gethostnameinfo(sa, node, nodelen, flags); + int ret = gethostnameinfo(sa, node, nodelen, flags); + if (ret) + return ret; } if (service) {