]> 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 04:30:51 +0000 (14:30 +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.

(cherry picked from commit deb3b85cb2faba8fd72172a8df0e0631033196aa)

bin/dig/dighost.c

index be472d0d2616564c2cb0312ffe84aff397c91f19..7d3bcd25ea94108e0d2f269537d05f433870c71e 100644 (file)
@@ -3526,6 +3526,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);