From 5cc841fa53c37582a2181bc4fad96da99403df4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= Date: Fri, 24 Aug 2018 13:49:45 +0200 Subject: [PATCH] Reset dig exit code after a TCP connection is established 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index a8c0e4d808..6d2fe1f558 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -3244,6 +3244,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);