From 46af7e9c0fea764f197fd7bf5d6c612d07b12b48 Mon Sep 17 00:00:00 2001 From: DavidBar-On Date: Tue, 11 Feb 2025 17:41:42 +0200 Subject: [PATCH] Add also SIGINT to the non-error signals --- src/iperf_api.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/iperf_api.c b/src/iperf_api.c index 80a788b25..37fd165a2 100644 --- a/src/iperf_api.c +++ b/src/iperf_api.c @@ -4847,7 +4847,7 @@ iperf_catch_sigend(void (*handler)(int)) void iperf_got_sigend(struct iperf_test *test, int sig) { - int exit_type; + int exit_normal; /* * If we're the client, or if we're a server and running a test, @@ -4871,17 +4871,20 @@ iperf_got_sigend(struct iperf_test *test, int sig) } i_errno = (test->role == 'c') ? IECLIENTTERM : IESERVERTERM; - exit_type = 0; + exit_normal = 0; #ifdef SIGTERM if (sig == SIGTERM) - exit_type = 1; - else + exit_normal = 1; +#endif +#ifdef SIGINT + if (sig == SIGINT) + exit_normal = 1; #endif #ifdef SIGHUP if (sig == SIGHUP) - exit_type = 1; + exit_normal = 1; #endif - if (exit_type == 1) { + if (exit_normal) { iperf_signormalexit(test, "interrupt - %s by signal %s(%d)", iperf_strerror(i_errno), strsignal(sig), sig); } else { iperf_errexit(test, "interrupt - %s by signal %s(%d)", iperf_strerror(i_errno), strsignal(sig), sig);