From e1d2b322ace9628a832349baddf4f62a67d47ffa Mon Sep 17 00:00:00 2001 From: Kaian Date: Fri, 24 Feb 2023 11:08:11 +0100 Subject: [PATCH] core: stop running when ssh connection has lost #424 --- src/util.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util.c b/src/util.c index afa1a33..9770430 100644 --- a/src/util.c +++ b/src/util.c @@ -65,6 +65,12 @@ void setup_sigterm_handler(void) exit(EXIT_FAILURE); if (signal(SIGQUIT, sigterm_handler) == SIG_ERR) 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)