glibc 2.2.93 gethostbyname_r() no longer returns ERANGE if the given buffer
size isn't big enough. For some reason they now return EAGAIN. Redhat 8 ships with this glibc version.
This commit is contained in:
parent
0fa512f26d
commit
32c03eadd6
27
lib/hostip.c
27
lib/hostip.c
@ -597,14 +597,25 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
|||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
#ifdef HAVE_GETHOSTBYNAME_R_6
|
||||||
/* Linux */
|
/* Linux */
|
||||||
while((res=gethostbyname_r(hostname,
|
do {
|
||||||
(struct hostent *)buf,
|
res=gethostbyname_r(hostname,
|
||||||
(char *)buf + sizeof(struct hostent),
|
(struct hostent *)buf,
|
||||||
step_size - sizeof(struct hostent),
|
(char *)buf + sizeof(struct hostent),
|
||||||
&h, /* DIFFERENCE */
|
step_size - sizeof(struct hostent),
|
||||||
&h_errnop))==ERANGE) {
|
&h, /* DIFFERENCE */
|
||||||
step_size+=200;
|
&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. */
|
||||||
|
|
||||||
|
if((ERANGE == res) || (EAGAIN == res)) {
|
||||||
|
step_size+=200;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
} while(1);
|
||||||
|
|
||||||
if(!h) /* failure */
|
if(!h) /* failure */
|
||||||
res=1;
|
res=1;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user