From: Fabian Keil Date: Sat, 27 Oct 2007 13:02:27 +0000 (+0000) Subject: Relocate daemon-mode-related log messages to make sure X-Git-Tag: v_3_0_7~115 X-Git-Url: http://www.privoxy.org/gitweb/installation.html?a=commitdiff_plain;h=8defbd56623783ab1c336d64f411eeae397c3f33;p=privoxy.git Relocate daemon-mode-related log messages to make sure they aren't shown again in case of configuration reloads. --- diff --git a/errlog.c b/errlog.c index 49caf8ab..03062421 100644 --- a/errlog.c +++ b/errlog.c @@ -1,4 +1,4 @@ -const char errlog_rcs[] = "$Id: errlog.c,v 1.55 2007/10/14 14:12:41 fabiankeil Exp $"; +const char errlog_rcs[] = "$Id: errlog.c,v 1.56 2007/10/14 14:26:56 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/errlog.c,v $ @@ -33,6 +33,9 @@ const char errlog_rcs[] = "$Id: errlog.c,v 1.55 2007/10/14 14:12:41 fabiankeil E * * Revisions : * $Log: errlog.c,v $ + * Revision 1.56 2007/10/14 14:26:56 fabiankeil + * Remove the old log_error() version. + * * Revision 1.55 2007/10/14 14:12:41 fabiankeil * When in daemon mode, close stderr after the configuration file has been * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436. @@ -511,9 +514,11 @@ void disable_logging(void) lock_logfile(); if (logfp != NULL) { + log_error(LOG_LEVEL_INFO, + "No logfile configured while in daemon mode. Logging disabled."); fclose(logfp); + logfp = NULL; } - logfp = NULL; unlock_logfile(); } @@ -543,7 +548,12 @@ void init_error_log(const char *prog_name, const char *logfname) lock_loginit(); lock_logfile(); - if ((logfp != NULL) && (logfp != stderr)) + if (logfp == stderr) + { + log_error(LOG_LEVEL_INFO, + "Switching to daemon mode. Log messages will be written to: %s", logfname); + } + else if (logfp != NULL) { log_error(LOG_LEVEL_INFO, "(Re-)Open logfile \'%s\'", logfname ? logfname : "none"); } diff --git a/loadcfg.c b/loadcfg.c index 1e6dc57d..334f07f8 100644 --- a/loadcfg.c +++ b/loadcfg.c @@ -1,4 +1,4 @@ -const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.67 2007/10/14 14:12:41 fabiankeil Exp $"; +const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.68 2007/10/19 16:32:34 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $ @@ -35,6 +35,9 @@ const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.67 2007/10/14 14:12:41 fabiankeil * * Revisions : * $Log: loadcfg.c,v $ + * Revision 1.68 2007/10/19 16:32:34 fabiankeil + * Plug memory leak introduced with my last commit. + * * Revision 1.67 2007/10/14 14:12:41 fabiankeil * When in daemon mode, close stderr after the configuration file has been * parsed the first time. If logfile isn't set, stop logging. Fixes BR#897436. @@ -1619,13 +1622,10 @@ struct configuration_spec * load_config(void) if (NULL != logfile) { config->logfile = logfile; - log_error(LOG_LEVEL_INFO, - "Switching to daemon mode. Log messages will be written to: %s", config->logfile); init_error_log(Argv[0], config->logfile); } else { - log_error(LOG_LEVEL_INFO, "No logfile configured while in daemon mode. Logging disabled."); disable_logging(); } }