summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-13 04:36:35 +0000
committerUlrich Drepper <drepper@redhat.com>2008-06-13 04:36:35 +0000
commitf854efd7224944b15ba3068de28c0d00550f88b7 (patch)
tree24972dae67b780b685f7d0117b5d1890e7700025 /resolv
parent46f70b3ce849ae22fcf6f81802b2eb622b97723e (diff)
downloadglibc-f854efd7224944b15ba3068de28c0d00550f88b7.tar.gz
glibc-f854efd7224944b15ba3068de28c0d00550f88b7.tar.xz
glibc-f854efd7224944b15ba3068de28c0d00550f88b7.zip
* resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
	unconditionally use second gaih_getanswer_slice result.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/nss_dns/dns-host.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index f99db1c64f..cae077445f 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -1097,11 +1097,7 @@ gaih_getanswer_slice (const querybuf *answer, int anslen, const char *qname,
 
 	  if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple),
 				0))
-	    {
-	      *errnop = ERANGE;
-	      *h_errnop = NETDB_INTERNAL;
-	      return NSS_STATUS_TRYAGAIN;
-	    }
+	    goto too_small;
 
 	  *pat = (struct gaih_addrtuple *) buffer;
 	  buffer += sizeof (struct gaih_addrtuple);
@@ -1175,11 +1171,17 @@ gaih_getanswer (const querybuf *answer1, int anslen1, const querybuf *answer2,
 				  &pat, &buffer, &buflen,
 				  errnop, h_errnop, ttlp,
 				  &first);
-  if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND)
+  if ((status == NSS_STATUS_SUCCESS || status == NSS_STATUS_NOTFOUND
+       || status == NSS_STATUS_TRYAGAIN)
       && answer2 != NULL && anslen2 > 0)
-    status = gaih_getanswer_slice(answer2, anslen2, qname,
-				  &pat, &buffer, &buflen,
-				  errnop, h_errnop, ttlp, &first);
+    {
+      enum nss_status status2 = gaih_getanswer_slice(answer2, anslen2, qname,
+						     &pat, &buffer, &buflen,
+						     errnop, h_errnop, ttlp,
+						     &first);
+      if (status != NSS_STATUS_SUCCESS)
+	status = status2;
+    }
 
   return status;
 }