From f378d8f9dc55207e1dd012e16455be83d36149d3 Mon Sep 17 00:00:00 2001 From: pb Date: Mon, 5 Apr 2004 20:18:48 +0000 Subject: 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 --- lib/libc/net/name6.c | 16 ++++++++++++---- 1 file 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 -- cgit v1.1