Skip to content

Commit

Permalink
canfdtest: don't remap SIG to 0
Browse files Browse the repository at this point in the history
Scripts can be configured to handle different SIGnals and
return codes in different ways. In this case it is better
to forward received signal, instead of converting it to return 0.

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
  • Loading branch information
olerem committed Sep 18, 2018
1 parent 7a4dd73 commit 1883441
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions canfdtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static int running = 1;
static int verbose;
static int sockfd;
static int test_loops;
static int exit_sig;

static void print_usage(char *prg)
{
Expand Down Expand Up @@ -149,6 +150,7 @@ static void signal_handler(int signo)
{
close(sockfd);
running = 0;
exit_sig = signo;
}

static int recv_frame(struct can_frame *frame)
Expand Down Expand Up @@ -355,5 +357,11 @@ int main(int argc, char *argv[])
printf("Exiting...\n");

close(sockfd);

if (exit_sig) {
signal(exit_sig, SIG_DFL);
kill(getpid(), exit_sig);
}

return err;
}

0 comments on commit 1883441

Please sign in to comment.