dig previously set an exit code of 9 when a TCP connection failed
or when a UDP connection timed out, but when the server address is
localhost it's possible for a UDP query to fail with ISC_R_CONNREFUSED.
that code path didn't update the exit code, causing dig to exit with
status 0. we now set the exit code to 9 in this failure case.
dig_lookup_t *l = query->lookup;
debug("udp setup failed: %s", isc_result_totext(eresult));
+
+ if (exitcode < 9) {
+ exitcode = 9;
+ }
query_detach(&query);
cancel_lookup(l);
lookup_detach(&l);
if (eresult == ISC_R_EOF) {
requeue_or_update_exitcode(l);
+ } else if (exitcode < 9) {
+ exitcode = 9;
}
goto cancel_lookup;