candump: 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
cfe41963f3
commit
4ec42fa089
|
|
@ -118,6 +118,7 @@ static const char extra_m_info[4][4] = { "- -", "B -", "- E", "B E" };
|
||||||
extern int optind, opterr, optopt;
|
extern int optind, opterr, optopt;
|
||||||
|
|
||||||
static volatile int running = 1;
|
static volatile int running = 1;
|
||||||
|
static volatile sig_atomic_t signal_num;
|
||||||
|
|
||||||
static void print_usage(void)
|
static void print_usage(void)
|
||||||
{
|
{
|
||||||
|
|
@ -169,6 +170,7 @@ static void print_usage(void)
|
||||||
static void sigterm(int signo)
|
static void sigterm(int signo)
|
||||||
{
|
{
|
||||||
running = 0;
|
running = 0;
|
||||||
|
signal_num = signo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int idx2dindex(int ifidx, int socket)
|
static int idx2dindex(int ifidx, int socket)
|
||||||
|
|
@ -861,5 +863,8 @@ int main(int argc, char **argv)
|
||||||
if (log)
|
if (log)
|
||||||
fclose(logfile);
|
fclose(logfile);
|
||||||
|
|
||||||
|
if (signal_num)
|
||||||
|
return 128 + signal_num;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue