diff options
author | Gisle Vanem <gvanem@broadpark.no> | 2005-02-08 12:36:13 +0000 |
---|---|---|
committer | Gisle Vanem <gvanem@broadpark.no> | 2005-02-08 12:36:13 +0000 |
commit | d118312922cc5415b26afd2eae2849c2c56a3359 (patch) | |
tree | eeec34df7698108963ac29387cfc00489fdaadf3 /lib/hostasyn.c | |
parent | 82b93e494583f87bee0bef33575f5c3d07253791 (diff) | |
download | curl-d118312922cc5415b26afd2eae2849c2c56a3359.tar.gz |
Curl_addrinfo?_callback() and addrinfo_callback() now returns
CURLE_OK or CURLE_OUT_OF_MEMORY.
Add typecast in hostares.c.
Diffstat (limited to 'lib/hostasyn.c')
-rw-r--r-- | lib/hostasyn.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lib/hostasyn.c b/lib/hostasyn.c index 2abad14fd..ec7a34a43 100644 --- a/lib/hostasyn.c +++ b/lib/hostasyn.c @@ -108,12 +108,13 @@ * * The storage operation locks and unlocks the DNS cache. */ -static void addrinfo_callback(void *arg, /* "struct connectdata *" */ - int status, - void *addr) +static CURLcode addrinfo_callback(void *arg, /* "struct connectdata *" */ + int status, + void *addr) { struct connectdata *conn = (struct connectdata *)arg; struct Curl_dns_entry *dns = NULL; + CURLcode rc = CURLE_OK; conn->async.status = status; @@ -135,13 +136,17 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */ dns = Curl_cache_addr(data, ai, conn->async.hostname, conn->async.port); - if(!dns) + if(!dns) { /* failed to store, cleanup and return error */ Curl_freeaddrinfo(ai); + rc = CURLE_OUT_OF_MEMORY; + } if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); } + else + rc = CURLE_OUT_OF_MEMORY; } conn->async.dns = dns; @@ -153,21 +158,22 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */ /* ipv4: The input hostent struct will be freed by ares when we return from this function */ + return rc; } -void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */ - int status, - struct hostent *hostent) +CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */ + int status, + struct hostent *hostent) { - addrinfo_callback(arg, status, hostent); + return addrinfo_callback(arg, status, hostent); } #ifdef CURLRES_IPV6 -void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */ - int status, - struct addrinfo *ai) +CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */ + int status, + struct addrinfo *ai) { - addrinfo_callback(arg, status, ai); + return addrinfo_callback(arg, status, ai); } #endif |