summaryrefslogtreecommitdiff
path: root/resolv
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2010-04-05 12:21:20 -0700
committerPetr Baudis <pasky@ucw.cz>2010-05-12 03:21:13 +0200
commit52ade99fe57673eccffbcd71dea61692c424930d (patch)
treefdab58e6f98747ce4847ebb0182af85fa70649c7 /resolv
parentfbca690a79f9b0232acc0e1d8504d62243bcdbb0 (diff)
downloadglibc-52ade99fe57673eccffbcd71dea61692c424930d.tar.gz
Handle DNS timeouts in old-style lookkup code.
(cherry picked from commit 4535680d03d15dc9ce19d97b9d242a10941d5016)
Diffstat (limited to 'resolv')
-rw-r--r--resolv/nss_dns/dns-host.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c
index 818a40a898..e0c4978c3b 100644
--- a/resolv/nss_dns/dns-host.c
+++ b/resolv/nss_dns/dns-host.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2004, 2007-2009, 2010 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Extended from original form by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -198,21 +198,27 @@ _nss_dns_gethostbyname3_r (const char *name, int af, struct hostent *result,
1024, &host_buffer.ptr, NULL, NULL, NULL);
if (n < 0)
{
- if (errno == ESRCH)
+ switch (errno)
{
+ case ESRCH:
status = NSS_STATUS_TRYAGAIN;
h_errno = TRY_AGAIN;
+ break;
+ case ECONNREFUSED:
+ case ETIMEDOUT:
+ status = NSS_STATUS_UNAVAIL;
+ break;
+ default:
+ status = NSS_STATUS_NOTFOUND;
+ break;
}
- else
- status = (errno == ECONNREFUSED
- ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND);
*h_errnop = h_errno;
if (h_errno == TRY_AGAIN)
*errnop = EAGAIN;
else
__set_errno (olderr);
- /* If we are looking for a IPv6 address and mapping is enabled
+ /* If we are looking for an IPv6 address and mapping is enabled
by having the RES_USE_INET6 bit in _res.options set, we try
another lookup. */
if (af == AF_INET6 && (_res.options & RES_USE_INET6))