about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-09-12 19:24:42 +0000
committerUlrich Drepper <drepper@redhat.com>1999-09-12 19:24:42 +0000
commita0bf6ac732c7cbe42939782d38a9bb1d7403c86a (patch)
treeb0b69c735cc22c5f3bc188c90c350bb760d5413e /resolv
parent9e5dcaa88cf86706b0cd17b49cfe299b198aaef0 (diff)
downloadglibc-a0bf6ac732c7cbe42939782d38a9bb1d7403c86a.tar.gz
glibc-a0bf6ac732c7cbe42939782d38a9bb1d7403c86a.tar.xz
glibc-a0bf6ac732c7cbe42939782d38a9bb1d7403c86a.zip
Update.
	* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): If res_search
	fails don't rely on errno value.
	(getanswer_r): Set *ERRNOP in error cases.

	* sysdeps/posix/getaddrinfo.c (gaih_local): Test protocol and socktype.
	(gaih_inet_serv): Return EIA_NODATA if name is known but has no
	associated data.  Test for matching numeric address and family.
	(getaddrinfo): Remember EAI_NODATA result and return this in case
	everything fails.
	Reported by Arkadiusz Miskiewicz <misiek@misiek.eu.org>.
Diffstat (limited to 'resolv')
-rw-r--r--resolv/nss_dns/dns-host.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 746bfcf313..c075961e91 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -163,7 +163,7 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
   if (n < 0)
     {
       *h_errnop = h_errno;
-      *errnop = errno;
+      *errnop = *h_errnop == TRY_AGAIN ? EAGAIN : ENOENT;
       return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
     }
 
@@ -342,6 +342,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
       name_ok = res_dnok;
       break;
     default:
+      *errnop = ENOENT;
       return NSS_STATUS_UNAVAIL;  /* XXX should be abort(); */
     }
 
@@ -356,6 +357,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
   if (qdcount != 1)
     {
       *h_errnop = NO_RECOVERY;
+      *errnop = ENOENT;
       return NSS_STATUS_UNAVAIL;
     }
 
@@ -390,6 +392,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
       if (n >= MAXHOSTNAMELEN)
 	{
 	  *h_errnop = NO_RECOVERY;
+	  *errnop = ENOENT;
 	  return NSS_STATUS_TRYAGAIN;
 	}
       result->h_name = bp;
@@ -660,5 +663,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
     }
  no_recovery:
   *h_errnop = NO_RECOVERY;
+  *errnop = ENOENT;
   return NSS_STATUS_TRYAGAIN;
 }