mirror of https://github.com/moparisthebest/curl
Make use of gethostname() conditional on it being available
This commit is contained in:
parent
00142d8443
commit
e4dabef0c7
|
@ -225,6 +225,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten
|
||||||
We do this by determining our own domain name, then searching the string
|
We do this by determining our own domain name, then searching the string
|
||||||
for this domain name and removing it.
|
for this domain name and removing it.
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_GETHOSTNAME
|
||||||
if (niquery->flags & ARES_NI_NOFQDN)
|
if (niquery->flags & ARES_NI_NOFQDN)
|
||||||
{
|
{
|
||||||
char buf[255];
|
char buf[255];
|
||||||
|
@ -237,6 +238,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten
|
||||||
*end = 0;
|
*end = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, (char *)(host->h_name),
|
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, (char *)(host->h_name),
|
||||||
service);
|
service);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -966,7 +966,9 @@ static int init_by_defaults(ares_channel channel)
|
||||||
*/
|
*/
|
||||||
size_t len = 64;
|
size_t len = 64;
|
||||||
int res;
|
int res;
|
||||||
|
channel->ndomains = 0; /* default to none */
|
||||||
|
|
||||||
|
#ifdef HAVE_GETHOSTNAME
|
||||||
hostname = malloc(len);
|
hostname = malloc(len);
|
||||||
if(!hostname) {
|
if(!hostname) {
|
||||||
rc = ARES_ENOMEM;
|
rc = ARES_ENOMEM;
|
||||||
|
@ -994,7 +996,6 @@ static int init_by_defaults(ares_channel channel)
|
||||||
|
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
channel->ndomains = 0; /* default to none */
|
|
||||||
if (strchr(hostname, '.')) {
|
if (strchr(hostname, '.')) {
|
||||||
/* a dot was found */
|
/* a dot was found */
|
||||||
|
|
||||||
|
@ -1010,6 +1011,7 @@ static int init_by_defaults(ares_channel channel)
|
||||||
}
|
}
|
||||||
channel->ndomains = 1;
|
channel->ndomains = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel->nsort == -1) {
|
if (channel->nsort == -1) {
|
||||||
|
|
|
@ -97,6 +97,9 @@
|
||||||
/* Define if you have the strnicmp function. */
|
/* Define if you have the strnicmp function. */
|
||||||
#define HAVE_STRNICMP 1
|
#define HAVE_STRNICMP 1
|
||||||
|
|
||||||
|
/* Define if you have the gethostname function. */
|
||||||
|
#define HAVE_GETHOSTNAME 1
|
||||||
|
|
||||||
/* Define if you have the recv function. */
|
/* Define if you have the recv function. */
|
||||||
#define HAVE_RECV 1
|
#define HAVE_RECV 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue