git: e59571c5a789 - stable/14 - timeout(1): Fix the handling of repeated terminating signals

From: Konstantin Belousov <kib_at_FreeBSD.org>
Date: Mon, 16 Jun 2025 08:54:04 UTC
The branch stable/14 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e59571c5a78988a13eeaa473302a4029a459022f

commit e59571c5a78988a13eeaa473302a4029a459022f
Author:     Aaron LI <aly@aaronly.me>
AuthorDate: 2025-04-02 16:14:40 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2025-06-16 08:51:53 +0000

    timeout(1): Fix the handling of repeated terminating signals
    
    (cherry picked from commit aae3eb24dfdbbe0a9e62fe7239d6038060cd07f6)
---
 bin/timeout/timeout.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/bin/timeout/timeout.c b/bin/timeout/timeout.c
index e702803a25c2..c3c7532a9d08 100644
--- a/bin/timeout/timeout.c
+++ b/bin/timeout/timeout.c
@@ -49,7 +49,6 @@
 static volatile sig_atomic_t sig_chld = 0;
 static volatile sig_atomic_t sig_term = 0;
 static volatile sig_atomic_t sig_alrm = 0;
-static volatile sig_atomic_t sig_ign = 0;
 static const char *command = NULL;
 static bool verbose = false;
 
@@ -138,11 +137,6 @@ parse_signal(const char *str)
 static void
 sig_handler(int signo)
 {
-	if (sig_ign != 0 && signo == sig_ign) {
-		sig_ign = 0;
-		return;
-	}
-
 	switch (signo) {
 	case SIGINT:
 	case SIGHUP:
@@ -377,19 +371,11 @@ main(int argc, char **argv)
 			if (do_second_kill) {
 				set_interval(second_kill);
 				do_second_kill = false;
-				sig_ign = killsig;
 				killsig = SIGKILL;
-			} else {
-				break;
 			}
 		}
 	}
 
-	while (!child_done && wait(&pstat) == -1) {
-		if (errno != EINTR)
-			err(EXIT_FAILURE, "wait()");
-	}
-
 	if (!foreground)
 		procctl(P_PID, getpid(), PROC_REAP_RELEASE, NULL);