summaryrefslogtreecommitdiff
path: root/ares_init.c
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2008-11-28 22:41:14 +0000
committerDan Fandrich <dan@coneharvesters.com>2008-11-28 22:41:14 +0000
commit9c51eb28fce70126987f65edd5469fc748150040 (patch)
treeb9f3ea23abde43b8fe44574a71c1b0bd43a3b594 /ares_init.c
parent36a6a6e175d977856e16dd0d8b645ef9906bafe5 (diff)
downloadc-ares-9c51eb28fce70126987f65edd5469fc748150040.tar.gz
c-ares-9c51eb28fce70126987f65edd5469fc748150040.tar.bz2
c-ares-9c51eb28fce70126987f65edd5469fc748150040.zip
Make use of gethostname() conditional on it being available
Diffstat (limited to 'ares_init.c')
-rw-r--r--ares_init.c4
1 files changed, 3 insertions, 1 deletions
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) {