From: Vsevolod Stakhov Date: Mon, 16 Jan 2017 18:04:21 +0000 (+0000) Subject: [Fix] Another try to fix reload and logger X-Git-Tag: 1.5.0~333 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3c18512f40f2feefbb31bae27bce805784e6607f;p=rspamd.git [Fix] Another try to fix reload and logger MFH: true --- 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"); } }