From 67f36528afce8e7dd5016283eb3da5a99be4778d Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Fri, 28 Aug 2009 13:42:51 +0200 Subject: [PATCH] Dump the dss configuration on startup and on SIGHUP. This makes it possible to look at the current dss configuration (which may differ from what is contained in the config file). This feature is handy for the users of dss and it helps to debug the dss code. --- dss.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dss.c b/dss.c index a233c11..c5f636c 100644 --- a/dss.c +++ b/dss.c @@ -888,7 +888,6 @@ static int parse_config_file(int override) log_welcome(conf.loglevel_arg); } DSS_DEBUG_LOG("loglevel: %d\n", conf.loglevel_arg); -// cmdline_parser_dump(logfile? logfile : stdout, &conf); ret = config_file_exists; out: free(config_file); @@ -903,14 +902,24 @@ static int change_to_dest_dir(void) return dss_chdir(conf.dest_dir_arg); } +static void dump_dss_config(const char *msg) +{ + if (conf.loglevel_arg > INFO) + return; + DSS_INFO_LOG("%s\n", msg); + cmdline_parser_dump(logfile? logfile : stderr, &conf); +} + static int handle_sighup(void) { int ret; - DSS_NOTICE_LOG("SIGHUP\n"); + DSS_NOTICE_LOG("SIGHUP, re-reading config\n"); + dump_dss_config("current config"); ret = parse_config_file(1); if (ret < 0) return ret; + dump_dss_config("new config"); invalidate_next_snapshot_time(); return change_to_dest_dir(); } @@ -1315,6 +1324,7 @@ int main(int argc, char **argv) } if (conf.daemon_given) daemon_init(); + dump_dss_config("dss configuration"); ret = change_to_dest_dir(); if (ret < 0) goto out; -- 2.39.2