aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-16 18:04:21 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-16 18:04:21 +0000
commit3c18512f40f2feefbb31bae27bce805784e6607f (patch)
tree255a1a41b1c5b6f1e75e590ab0366f5081ee2e18
parent8cf07fdcdd243f7fff5e61093d3a10d29de132aa (diff)
downloadrspamd-3c18512f40f2feefbb31bae27bce805784e6607f.tar.gz
rspamd-3c18512f40f2feefbb31bae27bce805784e6607f.zip
[Fix] Another try to fix reload and logger
MFH: true
-rw-r--r--src/rspamd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rspamd.c b/src/rspamd.c
index 158ad1185..f50025105 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -267,7 +267,7 @@ config_logger (rspamd_mempool_t *pool, gpointer ud)
static void
reread_config (struct rspamd_main *rspamd_main)
{
- struct rspamd_config *tmp_cfg;
+ struct rspamd_config *tmp_cfg, *old_cfg;
gchar *cfg_file;
tmp_cfg = rspamd_config_new ();
@@ -278,9 +278,12 @@ reread_config (struct rspamd_main *rspamd_main)
rspamd_main->cfg->cfg_name);
/* Save some variables */
tmp_cfg->cfg_name = cfg_file;
+ old_cfg = rspamd_main->cfg;
+ rspamd_main->cfg = tmp_cfg;
if (!load_rspamd_config (rspamd_main, tmp_cfg, TRUE,
RSPAMD_CONFIG_INIT_VALIDATE|RSPAMD_CONFIG_INIT_SYMCACHE)) {
+ rspamd_main->cfg = old_cfg;
rspamd_log_close_priv (rspamd_main->logger,
rspamd_main->workers_uid,
rspamd_main->workers_gid);
@@ -294,8 +297,7 @@ reread_config (struct rspamd_main *rspamd_main)
}
else {
msg_debug_main ("replacing config");
- REF_RELEASE (rspamd_main->cfg);
- rspamd_main->cfg = tmp_cfg;
+ REF_RELEASE (old_cfg);
msg_info_main ("config has been reread successfully");
}
}