summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2010-08-29 03:53:17 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2010-08-29 03:53:17 +0000
commit27b516d5e2ab8e5e6b1d254e2ec4c339dd294313 (patch)
treecc9afc7cd020704d859553eabc941ade201bae58 /lib/libc
parentc93734c0184c75b3c4993229dd956e1c508b20c5 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/net/gethostbydns.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c
index dc1047928684..f301c8801734 100644
--- a/lib/libc/net/gethostbydns.c
+++ b/lib/libc/net/gethostbydns.c
@@ -522,18 +522,26 @@ _dns_gethostbyname(void *rval, void *cb_data, va_list ap)
free(buf);
dprintf("res_nsearch failed (%d)\n", n, statp);
*h_errnop = statp->res_h_errno;
- return (0);
+ return (NS_NOTFOUND);
} else if (n > sizeof(buf->buf)) {
free(buf);
dprintf("static buffer is too small (%d)\n", n, statp);
*h_errnop = statp->res_h_errno;
- return (0);
+ return (NS_UNAVAIL);
}
error = gethostanswer(buf, n, name, type, &he, hed, statp);
free(buf);
if (error != 0) {
*h_errnop = statp->res_h_errno;
- return (NS_NOTFOUND);
+ switch (statp->res_h_errno) {
+ case HOST_NOT_FOUND:
+ return (NS_NOTFOUND);
+ case TRY_AGAIN:
+ return (NS_TRYAGAIN);
+ default:
+ return (NS_UNAVAIL);
+ }
+ /*NOTREACHED*/
}
if (__copy_hostent(&he, hptr, buffer, buflen) != 0) {
*errnop = errno;
@@ -632,7 +640,15 @@ _dns_gethostbyaddr(void *rval, void *cb_data, va_list ap)
if (gethostanswer(buf, n, qbuf, T_PTR, &he, hed, statp) != 0) {
free(buf);
*h_errnop = statp->res_h_errno;
- return (NS_NOTFOUND); /* h_errno was set by gethostanswer() */
+ switch (statp->res_h_errno) {
+ case HOST_NOT_FOUND:
+ return (NS_NOTFOUND);
+ case TRY_AGAIN:
+ return (NS_TRYAGAIN);
+ default:
+ return (NS_UNAVAIL);
+ }
+ /*NOTREACHED*/
}
free(buf);
#ifdef SUNSECURITY