diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2008-11-28 22:41:14 +0000 |
---|---|---|
committer | Dan Fandrich <dan@coneharvesters.com> | 2008-11-28 22:41:14 +0000 |
commit | 9c51eb28fce70126987f65edd5469fc748150040 (patch) | |
tree | b9f3ea23abde43b8fe44574a71c1b0bd43a3b594 | |
parent | 36a6a6e175d977856e16dd0d8b645ef9906bafe5 (diff) | |
download | c-ares-9c51eb28fce70126987f65edd5469fc748150040.tar.gz c-ares-9c51eb28fce70126987f65edd5469fc748150040.tar.bz2 c-ares-9c51eb28fce70126987f65edd5469fc748150040.zip |
Make use of gethostname() conditional on it being available
-rw-r--r-- | ares_getnameinfo.c | 2 | ||||
-rw-r--r-- | ares_init.c | 4 | ||||
-rw-r--r-- | config-win32.h | 3 |
3 files changed, 8 insertions, 1 deletions
diff --git a/ares_getnameinfo.c b/ares_getnameinfo.c index 7bd4eca..c75e944 100644 --- a/ares_getnameinfo.c +++ b/ares_getnameinfo.c @@ -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 for this domain name and removing it. */ +#ifdef HAVE_GETHOSTNAME if (niquery->flags & ARES_NI_NOFQDN) { char buf[255]; @@ -237,6 +238,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts, struct hosten *end = 0; } } +#endif niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, (char *)(host->h_name), service); return; diff --git a/ares_init.c b/ares_init.c index 12161f3..7c355c3 100644 --- a/ares_init.c +++ b/ares_init.c @@ -966,7 +966,9 @@ static int init_by_defaults(ares_channel channel) */ size_t len = 64; int res; + channel->ndomains = 0; /* default to none */ +#ifdef HAVE_GETHOSTNAME hostname = malloc(len); if(!hostname) { rc = ARES_ENOMEM; @@ -994,7 +996,6 @@ static int init_by_defaults(ares_channel channel) } while(0); - channel->ndomains = 0; /* default to none */ if (strchr(hostname, '.')) { /* a dot was found */ @@ -1010,6 +1011,7 @@ static int init_by_defaults(ares_channel channel) } channel->ndomains = 1; } +#endif } if (channel->nsort == -1) { diff --git a/config-win32.h b/config-win32.h index 2245b03..dde9978 100644 --- a/config-win32.h +++ b/config-win32.h @@ -97,6 +97,9 @@ /* Define if you have the strnicmp function. */ #define HAVE_STRNICMP 1 +/* Define if you have the gethostname function. */ +#define HAVE_GETHOSTNAME 1 + /* Define if you have the recv function. */ #define HAVE_RECV 1 |