core: stop running when ssh connection has lost #424

This commit is contained in:
Kaian 2023-02-24 11:08:11 +01:00
parent 6aa93f242e
commit e1d2b322ac
1 changed files with 6 additions and 0 deletions

View File

@ -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)