aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/net/gethostbynis.c
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2005-04-30 19:28:31 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2005-04-30 19:28:31 +0000
commit6964622dd06c583e7242d0cc4d14cbfceb83bbb0 (patch)
tree118b5923c45222be426e700e5d3cfb98e6b86305 /lib/libc/net/gethostbynis.c
parente4f846efec4109dd451881a8c09009ba82af1e79 (diff)
downloadsrc-6964622dd06c583e7242d0cc4d14cbfceb83bbb0.tar.gz
src-6964622dd06c583e7242d0cc4d14cbfceb83bbb0.zip
handling RES_USE_INET6 better.
Notes
Notes: svn path=/head/; revision=145724
Diffstat (limited to 'lib/libc/net/gethostbynis.c')
-rw-r--r--lib/libc/net/gethostbynis.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index ca1a9a56ad87..45aed338ef4f 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$");
#ifdef YP
static int
_gethostbynis(const char *name, char *map, int af, struct hostent *he,
- struct hostent_data *hed)
+ struct hostent_data *hed, int mapped)
{
char *p, *bp, *ep;
char *cp, **q;
@@ -101,7 +101,7 @@ _gethostbynis(const char *name, char *map, int af, struct hostent *he,
addrok = inet_aton(result, (struct in_addr *)hed->host_addr);
if (addrok != 1)
break;
- if (_res.options & RES_USE_INET6) {
+ if (mapped) {
_map_v4v6_address((char *)hed->host_addr,
(char *)hed->host_addr);
af = AF_INET6;
@@ -172,7 +172,8 @@ _gethostbynisname_r(const char *name, int af, struct hostent *he,
map = "ipnodes.byname";
break;
}
- return _gethostbynis(name, map, af, he, hed);
+ return _gethostbynis(name, map, af, he, hed,
+ _res.options & RES_USE_INET6);
}
static int
@@ -192,7 +193,7 @@ _gethostbynisaddr_r(const char *addr, int len, int af, struct hostent *he,
}
if (inet_ntop(af, addr, numaddr, sizeof(numaddr)) == NULL)
return -1;
- return _gethostbynis(numaddr, map, af, he, hed);
+ return _gethostbynis(numaddr, map, af, he, hed, 0);
}
#endif /* YP */