c-ares: when resolving failed, persist error

Repeated calls to `Curl_async_is_resolved()` after a failure
returned OK and not the error that was the result of the resolve
fail.

Reported-by: Joshua Rogers
Closes #18999
This commit is contained in:
Stefan Eissing 2025-10-10 10:40:55 +02:00 committed by Daniel Stenberg
parent 03448f477a
commit 05fbe85e62
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -302,11 +302,13 @@ CURLcode Curl_async_is_resolved(struct Curl_easy *data,
if(data->state.async.done) {
*dns = data->state.async.dns;
return CURLE_OK;
return ares->result;
}
if(Curl_ares_perform(ares->channel, 0) < 0)
return CURLE_UNRECOVERABLE_POLL;
if(Curl_ares_perform(ares->channel, 0) < 0) {
result = CURLE_UNRECOVERABLE_POLL;
goto out;
}
#ifndef HAVE_CARES_GETADDRINFO
/* Now that we have checked for any last minute results above, see if there
@ -371,6 +373,9 @@ CURLcode Curl_async_is_resolved(struct Curl_easy *data,
result, *dns ? "" : "not ");
async_ares_cleanup(data);
}
out:
ares->result = result;
return result;
}