From 212c7ac334203eba0a7353a1b96f7d2fff1207fd Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 6 Oct 2010 16:05:29 +0200 Subject: [PATCH] Really handle SIG_TERM outside the signal handler --- src/main.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5eb040d..ea70d7a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -29,6 +29,7 @@ Updater::Ptr updater; volatile bool need_config_reload = false; volatile bool exit_now = false; +volatile bool caught_sig_term = false; volatile bool caught_sig_usr1 = false; volatile bool caught_sig_usr2 = false; volatile bool caught_sig_rtmin1 = false; @@ -141,8 +142,7 @@ int shutdown() */ void terminate(int param) { - updater->get_logger()->print_caught_sigterm(); - exit_now = true; + caught_sig_term = true; } /*lint !e715 */ @@ -339,6 +339,12 @@ int main(int argc, char *argv[]) // Go online - with webcheck is_online = true; webcheck_enabled = true; + } else if (caught_sig_term) + { + caught_sig_term = true; + updater->get_logger()->print_caught_sigterm(); + + exit_now = true; } // State handling -- 1.7.1