mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
Adjusted to the GETHOSTBYADDR_R_NARGS style
This commit is contained in:
parent
784c29c6c5
commit
8d76ad6c8e
14
lib/ftp.c
14
lib/ftp.c
@ -698,11 +698,25 @@ CURLcode _ftp(struct connectdata *conn)
|
|||||||
|
|
||||||
address = inet_addr(newhost);
|
address = inet_addr(newhost);
|
||||||
# if defined(HAVE_GETHOSTBYADDR_R)
|
# if defined(HAVE_GETHOSTBYADDR_R)
|
||||||
|
|
||||||
|
# if (GETHOSTBYADDR_R_NARGS < 8)
|
||||||
|
/* Solaris and IRIX */
|
||||||
answer = gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
|
answer = gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
|
||||||
(struct hostent *)hostent_buf,
|
(struct hostent *)hostent_buf,
|
||||||
hostent_buf + sizeof(*answer),
|
hostent_buf + sizeof(*answer),
|
||||||
sizeof(hostent_buf) - sizeof(*answer),
|
sizeof(hostent_buf) - sizeof(*answer),
|
||||||
&h_errnop);
|
&h_errnop);
|
||||||
|
# else
|
||||||
|
/* Linux style */
|
||||||
|
if(gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
|
||||||
|
(struct hostent *)hostent_buf,
|
||||||
|
hostent_buf + sizeof(*answer),
|
||||||
|
sizeof(hostent_buf) - sizeof(*answer),
|
||||||
|
&answer,
|
||||||
|
&h_errnop))
|
||||||
|
answer=NULL; /* error */
|
||||||
|
# endif
|
||||||
|
|
||||||
# else
|
# else
|
||||||
answer = gethostbyaddr((char *) &address, sizeof(address), AF_INET);
|
answer = gethostbyaddr((char *) &address, sizeof(address), AF_INET);
|
||||||
# endif
|
# endif
|
||||||
|
14
lib/hostip.c
14
lib/hostip.c
@ -120,10 +120,22 @@ struct hostent *GetHost(struct UrlData *data,
|
|||||||
else {
|
else {
|
||||||
int h_errnop;
|
int h_errnop;
|
||||||
memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */
|
memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */
|
||||||
|
#if (GETHOSTBYNAME_R_NARGS < 6)
|
||||||
|
/* Solaris, IRIX and more */
|
||||||
if ((h = gethostbyname_r(hostname,
|
if ((h = gethostbyname_r(hostname,
|
||||||
(struct hostent *)buf,buf +
|
(struct hostent *)buf,buf +
|
||||||
sizeof(struct hostent),buf_size -
|
sizeof(struct hostent),buf_size -
|
||||||
sizeof(struct hostent),&h_errnop)) == NULL ) {
|
sizeof(struct hostent),&h_errnop)) == NULL )
|
||||||
|
#else
|
||||||
|
/* Linux */
|
||||||
|
if( gethostbyname_r(hostname,
|
||||||
|
(struct hostent *)buf,buf +
|
||||||
|
sizeof(struct hostent),buf_size -
|
||||||
|
sizeof(struct hostent),
|
||||||
|
&h, /* DIFFERENCE */
|
||||||
|
&h_errnop))
|
||||||
|
#endif
|
||||||
|
{
|
||||||
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
Loading…
Reference in New Issue
Block a user