aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/posix/getaddrinfo.c23
2 files changed, 19 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index ff3ad65867..0ca11fbdee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-11-18 Ulrich Drepper <drepper@redhat.com>
+
+ * sysdeps/posix/getaddrinfo.c (gaih_inet): Only return -EAI_AGAIN
+ if IPv4 and IPv6 requests timed out.
+
2000-11-18 Akim Demaille <akim@epita.fr>
* malloc/obstack.h: Formatting changes.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 8b672f2b3f..1686933a21 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)