From 9af4b40d3886077df93b02458026f6a9766ac6c9 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 2 Feb 2007 00:23:55 +0000 Subject: fix obvious bug in ipv4/ipv6 resolving. When not using AF_INET, gethostbyname2_r tries to resolve an ipv6 address from /etc/hosts using get_hosts_byname_r, but with AF_INET instead of the supplied address family. This returns ipv4 addresses marked as ipv6 ones. Fix from nbd. --- libc/inet/resolv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libc/inet/resolv.c') diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 16d640e4f..68b096e1b 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -2130,7 +2130,7 @@ int gethostbyname2_r(const char *name, int family, int old_errno = errno; /* Save the old errno and reset errno */ __set_errno(0); /* to check for missing /etc/hosts. */ - if ((i=__get_hosts_byname_r(name, AF_INET, result_buf, + if ((i=__get_hosts_byname_r(name, family, result_buf, buf, buflen, result, h_errnop))==0) return i; switch (*h_errnop) { -- cgit v1.2.3