summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2005-05-01 07:39:45 +0000
committerume <ume@FreeBSD.org>2005-05-01 07:39:45 +0000
commit0adfc804de4b0f79c319eb0397d050f589b3d95b (patch)
treea2d2cad805f8380cd5fc12a8097dabf307f69025 /lib
parent09a70338b7c55bbade2bb9361c51fe9a81bc601a (diff)
downloadFreeBSD-src-0adfc804de4b0f79c319eb0397d050f589b3d95b.zip
FreeBSD-src-0adfc804de4b0f79c319eb0397d050f589b3d95b.tar.gz
don't see RES_USE_INET6 when called from getipnodeby*().
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/net/gethostbynis.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index ca1a9a5..1044fd6 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -202,14 +202,18 @@ _gethostbynisname(const char *name, int af)
{
#ifdef YP
struct hostdata *hd;
+ u_long oresopt;
+ int error;
if ((hd = __hostdata_init()) == NULL) {
h_errno = NETDB_INTERNAL;
return NULL;
}
- if (_gethostbynisname_r(name, af, &hd->host, &hd->data) != 0)
- return NULL;
- return &hd->host;
+ oresopt = _res.options;
+ _res.options &= ~RES_USE_INET6;
+ error = _gethostbynisname_r(name, af, &hd->host, &hd->data);
+ _res.options = oresopt;
+ return (error == 0) ? &hd->host : NULL;
#else
return NULL;
#endif
@@ -220,14 +224,18 @@ _gethostbynisaddr(const char *addr, int len, int af)
{
#ifdef YP
struct hostdata *hd;
+ u_long oresopt;
+ int error;
if ((hd = __hostdata_init()) == NULL) {
h_errno = NETDB_INTERNAL;
return NULL;
}
- if (_gethostbynisaddr_r(addr, len, af, &hd->host, &hd->data) != 0)
- return NULL;
- return &hd->host;
+ oresopt = _res.options;
+ _res.options &= ~RES_USE_INET6;
+ error = _gethostbynisaddr_r(addr, len, af, &hd->host, &hd->data);
+ _res.options = oresopt;
+ return (error == 0) ? &hd->host : NULL;
#else
return NULL;
#endif
OpenPOWER on IntegriCloud