From 7813b61a4128191279d0a3f90311787aad057b43 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 18 Nov 2000 08:30:20 +0000 Subject: [PATCH] Update. 2000-11-18 Ulrich Drepper * sysdeps/posix/getaddrinfo.c (gaih_inet): Only return -EAI_AGAIN if IPv4 and IPv6 requests timed out. --- ChangeLog | 5 +++++ sysdeps/posix/getaddrinfo.c | 23 ++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff3ad65..0ca11fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2000-11-18 Ulrich Drepper + + * sysdeps/posix/getaddrinfo.c (gaih_inet): Only return -EAI_AGAIN + if IPv4 and IPv6 requests timed out. + 2000-11-18 Akim Demaille * malloc/obstack.h: Formatting changes. diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 8b672f2..1686933 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -271,6 +271,7 @@ gaih_inet_serv (const char *servicename, struct gaih_typeproto *tp, struct hostent th; \ char *tmpbuf; \ tmpbuflen = 512; \ + no_data = 0; \ do { \ tmpbuflen *= 2; \ tmpbuf = __alloca (tmpbuflen); \ @@ -285,12 +286,11 @@ gaih_inet_serv (const char *servicename, struct gaih_typeproto *tp, return -EAI_SYSTEM; \ } \ if (herrno == TRY_AGAIN) \ - { \ - __set_h_errno (herrno); \ - return -EAI_AGAIN; \ - } \ + no_data = EAI_AGAIN; \ + else \ + no_data = herrno == NO_DATA; \ } \ - if (h != NULL) \ + else if (h != NULL) \ { \ for (i = 0; h->h_addr_list[i]; i++) \ { \ @@ -305,7 +305,6 @@ gaih_inet_serv (const char *servicename, struct gaih_typeproto *tp, pat = &((*pat)->next); \ } \ } \ - no_data = rc != 0 && herrno == NO_DATA; \ } static int @@ -510,9 +509,15 @@ gaih_inet (const char *name, const struct gaih_service *service, gethosts (AF_INET, struct in_addr); if (no_data != 0 && no_inet6_data != 0) - /* We made requests but they turned out no data. The name - is known, though. */ - return (GAIH_OKIFUNSPEC | -EAI_NODATA); + { + /* If both requests timed out report this. */ + if (no_data == EAI_AGAIN && no_inet6_data == EAI_AGAIN) + return -EAI_AGAIN; + + /* We made requests but they turned out no data. The name + is known, though. */ + return (GAIH_OKIFUNSPEC | -EAI_NODATA); + } } if (at->family == AF_UNSPEC) -- 2.7.4