cangen: 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. Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>pull/416/head
parent
4ec42fa089
commit
74e0d28d1a
5
cangen.c
5
cangen.c
|
|
@ -91,6 +91,7 @@
|
|||
extern int optind, opterr, optopt;
|
||||
|
||||
static volatile int running = 1;
|
||||
static volatile sig_atomic_t signal_num;
|
||||
static unsigned long long enobufs_count;
|
||||
static bool ignore_enobufs;
|
||||
static bool use_so_txtime;
|
||||
|
|
@ -220,6 +221,7 @@ static void print_usage(char *prg)
|
|||
static void sigterm(int signo)
|
||||
{
|
||||
running = 0;
|
||||
signal_num = signo;
|
||||
}
|
||||
|
||||
static int setsockopt_txtime(int fd)
|
||||
|
|
@ -887,5 +889,8 @@ int main(int argc, char **argv)
|
|||
|
||||
close(s);
|
||||
|
||||
if (signal_num)
|
||||
return 128 + signal_num;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue