From 19c8da85d8f5c645219f5da9df7acb10bcbb63d2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 2 Oct 2007 08:12:30 +0000 Subject: Fixed the problem where next_lookup would use 'status' uninitialized. Now it gets passed the initial value as an argument. --- ares/ares_gethostbyname.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/ares/ares_gethostbyname.c b/ares/ares_gethostbyname.c index b5f0e4236..bdc879196 100644 --- a/ares/ares_gethostbyname.c +++ b/ares/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, -- cgit v1.2.3