Skip to content

Commit 91519e7

Browse files
committed
rewrite EBADRESP to EBADQUERY on ares_send
Due to the way record duplication works, we might sometimes get a misleading error code. Rewrite the error code to make better sense. Authored-By: Brad House (@bradh352)
1 parent a70637c commit 91519e7

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/lib/ares_send.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ ares_status_t ares_send_nolock(ares_channel_t *channel, ares_server_t *server,
153153
/* Duplicate Query */
154154
status = ares_dns_record_duplicate_ex(&query->query, dnsrec);
155155
if (status != ARES_SUCCESS) {
156+
/* Sometimes we might get a EBADRESP response from duplicate due to
157+
* the way it works (write and parse), rewrite it to EBADQUERY. */
158+
if (status == ARES_EBADRESP) {
159+
status = ARES_EBADQUERY;
160+
}
156161
ares_free(query);
157162
callback(arg, status, 0, NULL);
158163
return status;

0 commit comments

Comments
 (0)