canfdtest: Follow Bash exit status when signaled

Bash and many other shells use 128 + signum as the exit status when a
program get signal and exit.  Follow the common behavior so that we
know how the programs are killed.

canfdtest.c was effectively raising the received signal again to run
the default signal handler.  This has been declined by the maintainer
because it's over-engineering.  This commit replaces it with the
method proposed by the maintainer.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
pull/416/head
Yasushi SHOJI 2023-03-20 10:07:33 +09:00
parent f45de1b782
commit 7e35c7e1de
1 changed files with 2 additions and 4 deletions

View File

@ -584,10 +584,8 @@ int main(int argc, char *argv[])
close(sockfd);
if (exit_sig) {
signal(exit_sig, SIG_DFL);
kill(getpid(), exit_sig);
}
if (exit_sig)
return 128 + exit_sig;
return err;
}