diff options
author | pb <pb@FreeBSD.org> | 2004-04-05 20:18:48 +0000 |
---|---|---|
committer | pb <pb@FreeBSD.org> | 2004-04-05 20:18:48 +0000 |
commit | f378d8f9dc55207e1dd012e16455be83d36149d3 (patch) | |
tree | 395d20b9fb09f4d56130b4685ec5e4ece2221187 /lib | |
parent | cffcc6d901cfc999a139cb66031d0b618f451673 (diff) | |
download | FreeBSD-src-f378d8f9dc55207e1dd012e16455be83d36149d3.zip FreeBSD-src-f378d8f9dc55207e1dd012e16455be83d36149d3.tar.gz |
Fix _dns_ghbyname() to return NS_TRYAGAIN instead of NS_NOTFOUND
on temporary nameserver failure. This is necessary to get
getipnodebyname(3) to correctly return h_errno=TRY_AGAIN instead
of HOST_NOT_FOUND.
Reviewed by: green, thomas
MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/name6.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c index 3d42e3c..1337598 100644 --- a/lib/libc/net/name6.c +++ b/lib/libc/net/name6.c @@ -1565,7 +1565,8 @@ _res_search_multi(name, rtl, errp) continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); - } + } else + *errp = h_errno; } if (hp0 != NULL) { free(buf); @@ -1604,7 +1605,8 @@ _res_search_multi(name, rtl, errp) continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); - } + } else + *errp = h_errno; } if (hp0 != NULL) { free(buf); @@ -1677,7 +1679,8 @@ _res_search_multi(name, rtl, errp) continue; hp = _hpcopy(&hpbuf, errp); hp0 = _hpmerge(hp0, hp, errp); - } + } else + *errp = h_errno; } if (hp0 != NULL) { free(buf); @@ -1739,7 +1742,12 @@ _dns_ghbyname(void *rval, void *cb_data, va_list ap) rtl = &rtl4; #endif *(struct hostent **)rval = _res_search_multi(name, rtl, errp); - return (*(struct hostent **)rval != NULL) ? NS_SUCCESS : NS_NOTFOUND; + if (*(struct hostent **)rval != NULL) + return NS_SUCCESS; + else if (*errp == TRY_AGAIN) + return NS_TRYAGAIN; + else + return NS_NOTFOUND; } static int |