aboutsummaryrefslogtreecommitdiffstats
path: root/src/rspamd.c
diff options
context:
space:
mode:
authorMikhail Galanin <mgalanin@mimecast.com>2018-08-30 14:03:01 +0100
committerMikhail Galanin <mgalanin@mimecast.com>2018-08-30 14:03:01 +0100
commit43d3cc3d8a4001c9cb65871a651fe81cbc6ee98e (patch)
treeec2a655a65f4dcc43a2359db69ad61b4a3bd528d /src/rspamd.c
parenta7543072058055ff88698383967cf83f58fa663d (diff)
downloadrspamd-43d3cc3d8a4001c9cb65871a651fe81cbc6ee98e.tar.gz
rspamd-43d3cc3d8a4001c9cb65871a651fe81cbc6ee98e.zip
[Minor] Log should not depend on config
When config is being closed, some destructors could be called, and that dtors could write into log. Hence, it is better to terminate config and only then close log. And log should not refer disposed config
Diffstat (limited to 'src/rspamd.c')
-rw-r--r--src/rspamd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/rspamd.c b/src/rspamd.c
index 9339e0a3f..fdc9b1b49 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -294,6 +294,7 @@ reread_config (struct rspamd_main *rspamd_main)
TRUE)) {
rspamd_main->cfg = old_cfg;
rspamd_log_close_priv (rspamd_main->logger,
+ FALSE,
rspamd_main->workers_uid,
rspamd_main->workers_gid);
rspamd_set_logger (rspamd_main->cfg, g_quark_try_string ("main"),
@@ -972,6 +973,7 @@ rspamd_hup_handler (gint signo, short what, gpointer arg)
" is restarting");
g_hash_table_foreach (rspamd_main->workers, kill_old_workers, NULL);
rspamd_log_close_priv (rspamd_main->logger,
+ FALSE,
rspamd_main->workers_uid,
rspamd_main->workers_gid);
reread_config (rspamd_main);
@@ -1288,8 +1290,8 @@ main (gint argc, gchar **argv, gchar **env)
exit (EXIT_SUCCESS);
}
- rspamd_log_close_priv (rspamd_main->logger, rspamd_main->workers_uid,
- rspamd_main->workers_gid);
+ rspamd_log_close_priv (rspamd_main->logger, FALSE,
+ rspamd_main->workers_uid, rspamd_main->workers_gid);
if (config_test || dump_cache) {
if (!load_rspamd_config (rspamd_main, rspamd_main->cfg, FALSE, 0,
@@ -1516,8 +1518,8 @@ main (gint argc, gchar **argv, gchar **env)
msg_info_main ("terminating...");
- rspamd_log_close (rspamd_main->logger);
REF_RELEASE (rspamd_main->cfg);
+ rspamd_log_close (rspamd_main->logger, TRUE);
g_hash_table_unref (rspamd_main->spairs);
g_hash_table_unref (rspamd_main->workers);
rspamd_mempool_delete (rspamd_main->server_pool);