From dbec3d56c146801fad339a1d46a388865b18ffb4 Mon Sep 17 00:00:00 2001 From: tilghman Date: Thu, 16 Aug 2007 21:09:46 +0000 Subject: Don't reload a configuration file if nothing has changed. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79747 f38db490-d61c-443f-a65b-d21fe96a405b --- main/logger.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'main/logger.c') diff --git a/main/logger.c b/main/logger.c index 209da2167..fff798aee 100644 --- a/main/logger.c +++ b/main/logger.c @@ -305,12 +305,16 @@ static struct logchannel *make_logchannel(char *channel, char *components, int l return chan; } -static void init_logger_chain(void) +static void init_logger_chain(int reload) { struct logchannel *chan; struct ast_config *cfg; struct ast_variable *var; const char *s; + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; + + if ((cfg = ast_config_load("logger.conf", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) + return; /* delete our list of log channels */ AST_RWLIST_WRLOCK(&logchannels); @@ -323,8 +327,6 @@ static void init_logger_chain(void) /* close syslog */ closelog(); - cfg = ast_config_load("logger.conf"); - /* If no config file, we're fine, set default options. */ if (!cfg) { if (errno) @@ -454,7 +456,7 @@ int reload_logger(int rotate) filesize_reload_needed = 0; - init_logger_chain(); + init_logger_chain(1); if (logfiles.event_log) { snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG); @@ -802,7 +804,7 @@ int init_logger(void) ast_mkdir(ast_config_AST_LOG_DIR, 0777); /* create log channels */ - init_logger_chain(); + init_logger_chain(0); /* create the eventlog */ if (logfiles.event_log) { -- cgit v1.2.3