Skip to content

Commit

Permalink
Add also SIGINT to the non-error signals
Browse files Browse the repository at this point in the history
  • Loading branch information
davidBar-On committed Feb 11, 2025
1 parent 7e8a19f commit 46af7e9
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/iperf_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 46af7e9

Please sign in to comment.