forked from Mirrors/sngrep
core: stop running when ssh connection has lost #424
This commit is contained in:
parent
6aa93f242e
commit
e1d2b322ac
|
@ -65,6 +65,12 @@ void setup_sigterm_handler(void)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
if (signal(SIGQUIT, sigterm_handler) == SIG_ERR)
|
if (signal(SIGQUIT, sigterm_handler) == SIG_ERR)
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
|
// Handle SIGCONT signal, received when parent process has died and
|
||||||
|
// kernel requests us to continue running. This prevents running on
|
||||||
|
// dead ssh connections.
|
||||||
|
if (signal(SIGCONT, sigterm_handler) == SIG_ERR)
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool was_sigterm_received(void)
|
bool was_sigterm_received(void)
|
||||||
|
|
Loading…
Reference in New Issue