mirror of https://github.com/moparisthebest/curl
Setup and use CURL_INADDR_NONE all over instead of INADDR_NONE. We setup
the define accordingly in the hostip.h header to work nicely all over.
This commit is contained in:
parent
a51258b6bb
commit
e615d117a0
|
@ -197,10 +197,6 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
|
|
||||||
#ifdef HAVE_INET_NTOA
|
#ifdef HAVE_INET_NTOA
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
|
||||||
#define INADDR_NONE (in_addr_t) ~0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
@ -216,7 +212,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
/* First check if the given name is an IP address */
|
/* First check if the given name is an IP address */
|
||||||
in=inet_addr(data->set.device);
|
in=inet_addr(data->set.device);
|
||||||
|
|
||||||
if((in == INADDR_NONE) &&
|
if((in == CURL_INADDR_NONE) &&
|
||||||
Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
|
Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
|
||||||
/*
|
/*
|
||||||
* We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer
|
* We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer
|
||||||
|
@ -250,7 +246,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||||
infof(data, "We bind local end to %s\n", myhost);
|
infof(data, "We bind local end to %s\n", myhost);
|
||||||
|
|
||||||
in=inet_addr(myhost);
|
in=inet_addr(myhost);
|
||||||
if (INADDR_NONE != in) {
|
if (CURL_INADDR_NONE != in) {
|
||||||
|
|
||||||
if ( h ) {
|
if ( h ) {
|
||||||
Curl_addrinfo *addr = h->addr;
|
Curl_addrinfo *addr = h->addr;
|
||||||
|
|
|
@ -532,10 +532,6 @@ static char *MakeIP(unsigned long num, char *addr, int addr_len)
|
||||||
return (addr);
|
return (addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef INADDR_NONE
|
|
||||||
#define INADDR_NONE (in_addr_t) ~0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void hostcache_fixoffset(struct hostent *h, int offset)
|
static void hostcache_fixoffset(struct hostent *h, int offset)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
|
@ -573,7 +569,8 @@ static Curl_addrinfo *my_getaddrinfo(struct SessionHandle *data,
|
||||||
port=0; /* unused in IPv4 code */
|
port=0; /* unused in IPv4 code */
|
||||||
ret = 0; /* to prevent the compiler warning */
|
ret = 0; /* to prevent the compiler warning */
|
||||||
|
|
||||||
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
|
in=inet_addr(hostname);
|
||||||
|
if (in != CURL_INADDR_NONE) {
|
||||||
struct in_addr *addrentry;
|
struct in_addr *addrentry;
|
||||||
struct namebuf {
|
struct namebuf {
|
||||||
struct hostent hostentry;
|
struct hostent hostentry;
|
||||||
|
|
|
@ -79,4 +79,11 @@ int curl_getaddrinfo(char *hostname, char *service,
|
||||||
int line, const char *source);
|
int line, const char *source);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef INADDR_NONE
|
||||||
|
#define CURL_INADDR_NONE (in_addr_t) ~0
|
||||||
|
#else
|
||||||
|
#define CURL_INADDR_NONE INADDR_NONE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue