aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2002-12-16 11:33:44 +0000
committerDaniel Stenberg <daniel@haxx.se>2002-12-16 11:33:44 +0000
commite879e26a5b93ac45531e5083ced7ab676b0ac996 (patch)
treec5732fcfea13d12d89291c286783e29f450d6d2e /lib/hostip.c
parent96d84150e11f405081ab8b9c0715190fd90842e3 (diff)
EAGAIN on older (correct) glibc versions indicate a problem and not the need
for a bigger buffer and this is indeed badness for us. Making this work on both old and new glibc versions require an ugly loop that in its worse form cause 45 bad loops when using the correct glibc and a non-resolving host name... :-/ We want a better fix. Badly.
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index bc0f4d979..f787f7051 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -631,16 +631,28 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data,
&h, /* DIFFERENCE */
&h_errnop);
/* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a
- sudden this function seems to be setting EAGAIN if the given buffer
- size is too small. Previous versions are known to return ERANGE for
- the same. */
+ sudden this function returns EAGAIN if the given buffer size is too
+ small. Previous versions are known to return ERANGE for the same
+ problem.
+
+ This wouldn't be such a big problem if older versions wouldn't
+ sometimes return EAGAIN on a common failure case. Alas, we can't
+ assume that EAGAIN *or* ERANGE means ERANGE for any given version of
+ glibc.
+
+ For now, we do that and thus we may call the function repeatedly and
+ fail for older glibc versions that return EAGAIN, until we run out
+ of buffer size (step_size grows beyond CURL_NAMELOOKUP_SIZE).
+
+ If anyone has a better fix, please tell us!
+ */
if((ERANGE == res) || (EAGAIN == res)) {
step_size+=200;
continue;
}
break;
- } while(1);
+ } while(step_size <= CURL_NAMELOOKUP_SIZE);
if(!h) /* failure */
res=1;