]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Reset dig exit code after a TCP connection is established
authorMichał Kępień <michal@isc.org>
Fri, 24 Aug 2018 11:49:45 +0000 (13:49 +0200)
committerMark Andrews <marka@isc.org>
Mon, 27 Aug 2018 03:58:08 +0000 (13:58 +1000)
The "exitcode" variable is set to 9 if a TCP connection fails, but is
not reset to 0 if a subsequent TCP connection succeeds.  This causes dig
to return a non-zero exit code if it succeeds in getting a TCP response
after a retry.  Fix by resetting "exitcode" to 0 if connect_done()
receives an event with the "result" field set to ISC_R_SUCCESS.

bin/dig/dighost.c

index 98e3595bb4fc914807078c3146342a1355fbeb0a..2903bb020c05a13c86350dac66596a2ea8a07a20 100644 (file)
@@ -3202,6 +3202,7 @@ connect_done(isc_task_t *task, isc_event_t *event) {
                UNLOCK_LOOKUP;
                return;
        }
+       exitcode = 0;
        if (keep_open) {
                if (keep != NULL)
                        isc_socket_detach(&keep);