summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2007-02-02 00:23:55 +0000
committerEric Andersen <andersen@codepoet.org>2007-02-02 00:23:55 +0000
commit9af4b40d3886077df93b02458026f6a9766ac6c9 (patch)
tree1b4514bea794adb7a2f629a1431bd1e72d94f1ed /libc
parent28f3c7c9130c9a8e796f40fe81745035c774b36a (diff)
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.
Diffstat (limited to 'libc')
-rw-r--r--libc/inet/resolv.c2
1 files changed, 1 insertions, 1 deletions
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) {