summaryrefslogtreecommitdiff
path: root/ares_gethostbyname.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-10-02 08:12:30 (GMT)
committerDaniel Stenberg <daniel@haxx.se>2007-10-02 08:12:30 (GMT)
commit338d59bd0b68e22f8b6363b97d7fda54d8c06026 (patch)
tree0ec7c5c5a329070aa859b9d8194eba7b64dee6fb /ares_gethostbyname.c
parent343d6f221fea91aa47cd1e8a3ed9d7c462fc6f7f (diff)
downloadc-ares-338d59bd0b68e22f8b6363b97d7fda54d8c06026.zip
c-ares-338d59bd0b68e22f8b6363b97d7fda54d8c06026.tar.gz
c-ares-338d59bd0b68e22f8b6363b97d7fda54d8c06026.tar.bz2
Fixed the problem where next_lookup would use 'status' uninitialized. Now
it gets passed the initial value as an argument.
Diffstat (limited to 'ares_gethostbyname.c')
-rw-r--r--ares_gethostbyname.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ares_gethostbyname.c b/ares_gethostbyname.c
index b5f0e42..bdc8791 100644
--- a/ares_gethostbyname.c
+++ b/ares_gethostbyname.c
@@ -57,7 +57,7 @@ struct host_query {
int timeouts;
};
-static void next_lookup(struct host_query *hquery);
+static void next_lookup(struct host_query *hquery, int status);
static void host_callback(void *arg, int status, int timeouts,
unsigned char *abuf, int alen);
static void end_hquery(struct host_query *hquery, int status,
@@ -111,12 +111,11 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family,
hquery->timeouts = 0;
/* Start performing lookups according to channel->lookups. */
- next_lookup(hquery);
+ next_lookup(hquery, ARES_SUCCESS);
}
-static void next_lookup(struct host_query *hquery)
+static void next_lookup(struct host_query *hquery, int status)
{
- int status;
const char *p;
struct hostent *host;
@@ -128,8 +127,8 @@ static void next_lookup(struct host_query *hquery)
/* DNS lookup */
hquery->remaining_lookups = p + 1;
if (hquery->family == AF_INET6)
- ares_search(hquery->channel, hquery->name, C_IN, T_AAAA, host_callback,
- hquery);
+ ares_search(hquery->channel, hquery->name, C_IN, T_AAAA,
+ host_callback, hquery);
else
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
@@ -183,7 +182,7 @@ static void host_callback(void *arg, int status, int timeouts,
else if (status == ARES_EDESTRUCTION)
end_hquery(hquery, status, NULL);
else
- next_lookup(hquery);
+ next_lookup(hquery, status);
}
static void end_hquery(struct host_query *hquery, int status,