From 4f4a6039b45feb31fca0526165d0165ba34d91e3 Mon Sep 17 00:00:00 2001 From: Thomas Jarosch Date: Wed, 6 Oct 2010 15:34:17 +0200 Subject: [PATCH] Don't reload config in the signal handler --- src/main.cpp | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 72f6860..94bc813 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,7 @@ using namespace std; Updater::Ptr updater; volatile bool is_online = false; volatile bool webcheck_enabled = false; +volatile bool need_config_reload = false; /** * Checks if a bpdyndnsd process is already running. @@ -161,8 +162,7 @@ void switch_to_offline(int param) void reload_config(int param) { updater->get_logger()->print_caught_sighup(); - if ( updater->reload_config() != 0 ) - exit(-1); + need_config_reload = true; } /*lint !e715 */ @@ -330,6 +330,14 @@ int main(int argc, char *argv[]) updater->get_logger()->print_offline_mode(); } + if (need_config_reload) + { + need_config_reload = false; + + if ( updater->reload_config() != 0 ) + exit(-1); + } + // Snore, snore... don't hog the cpu if we are in daemon_mode. if ( updater->get_config()->get_daemon_mode() == 1 ) sleep(10); /*lint !e534 */ -- 1.7.1