From a0bf6ac732c7cbe42939782d38a9bb1d7403c86a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 12 Sep 1999 19:24:42 +0000 Subject: 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 . --- resolv/nss_dns/dns-host.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'resolv') 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; } -- cgit v1.2.3