diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-01-14 14:12:37 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2003-01-14 14:12:37 (GMT) |
commit | 587b06788071e818823aabb5e31ef283f9278506 (patch) | |
tree | f7da9ee845a728f797a11b31fc9499a0731d528c /Source/CTest/Curl/hostip.c | |
parent | 6c61762b0f2d43b78f67b7ce9ec8d5f03765e11f (diff) | |
download | CMake-587b06788071e818823aabb5e31ef283f9278506.zip CMake-587b06788071e818823aabb5e31ef283f9278506.tar.gz CMake-587b06788071e818823aabb5e31ef283f9278506.tar.bz2 |
New Curl version 7.10.3
Diffstat (limited to 'Source/CTest/Curl/hostip.c')
-rw-r--r-- | Source/CTest/Curl/hostip.c | 42 |
1 files changed, 31 insertions, 11 deletions
diff --git a/Source/CTest/Curl/hostip.c b/Source/CTest/Curl/hostip.c index 07fb1d2..d79e832 100644 --- a/Source/CTest/Curl/hostip.c +++ b/Source/CTest/Curl/hostip.c @@ -88,7 +88,7 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data, void Curl_global_host_cache_init(void) { if (!host_cache_initialized) { - Curl_hash_init(&hostname_cache, 7, Curl_freeaddrinfo); + Curl_hash_init(&hostname_cache, 7, Curl_freednsinfo); host_cache_initialized = 1; } } @@ -287,17 +287,25 @@ struct Curl_dns_entry *Curl_resolv(struct SessionHandle *data, /* * This is a wrapper function for freeing name information in a protocol * independent way. This takes care of using the appropriate underlaying - * proper function. + * function. */ -void Curl_freeaddrinfo(void *freethis) +void Curl_freeaddrinfo(Curl_addrinfo *p) { - struct Curl_dns_entry *p = (struct Curl_dns_entry *) freethis; - #ifdef ENABLE_IPV6 - freeaddrinfo(p->addr); + freeaddrinfo(p); #else - free(p->addr); + free(p); #endif +} + +/* + * Free a cache dns entry. + */ +void Curl_freednsinfo(void *freethis) +{ + struct Curl_dns_entry *p = (struct Curl_dns_entry *) freethis; + + Curl_freeaddrinfo(p->addr); free(p); } @@ -623,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; |