about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--resolv/nss_dns/dns-host.c20
2 files changed, 14 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index a863b169bd..3fe121cf3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2008-06-12  Ulrich Drepper  <drepper@redhat.com>
 
+	* resolv/nss_dns/dns-host.c (gaih_getanswer): Don't
+	unconditionally use second gaih_getanswer_slice result.
+
 	* sysdeps/posix/getaddrinfo.c (gai_inet): Remove unnecessary test.
 	(getaddrinfo): RES must always be non-NULL.
 
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;
 }