mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
When received a signal, terminate with the same signal
This commit is contained in:
parent
fb2a9cbf00
commit
43e46cf013
1 changed files with 10 additions and 5 deletions
|
|
@ -908,10 +908,8 @@ volatile int global_interrupt = 0;
|
|||
/* LCOV_EXCL_START */
|
||||
void signal_handler(int signum)
|
||||
{
|
||||
(void)signum;
|
||||
|
||||
/* report the request of interruption */
|
||||
global_interrupt = 1;
|
||||
/* report the request of interruption with the signal received */
|
||||
global_interrupt = signum;
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
|
|
@ -2005,7 +2003,14 @@ int snapraid_main(int argc, char* argv[])
|
|||
#ifdef _WIN32
|
||||
exit(STATUS_CONTROL_C_EXIT);
|
||||
#else
|
||||
exit(128 + SIGINT);
|
||||
/* restore default handler */
|
||||
signal(global_interrupt, SIG_DFL);
|
||||
|
||||
/* raise the signal again*/
|
||||
raise(global_interrupt);
|
||||
|
||||
/* if raise() didn't terminate */
|
||||
_exit(128 + global_interrupt);
|
||||
#endif
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue