]> source.dussan.org Git - rspamd.git/commitdiff
Clean log buffer when forking
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Nov 2015 15:18:47 +0000 (15:18 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 25 Nov 2015 15:18:47 +0000 (15:18 +0000)
src/libutil/logger.c

index 5f5d062d3211f05193e5b939351650ae604f6b98..2c7ceeef74e9ca14196cca1bb7c81b216e17f535 100644 (file)
@@ -386,6 +386,21 @@ rspamd_log_update_pid (GQuark ptype, rspamd_logger_t *rspamd_log)
 {
        rspamd_log->pid = getpid ();
        rspamd_log->process_type = ptype;
+
+       /* We also need to clear all messages pending */
+       if (rspamd_log->repeats > 0) {
+               rspamd_log->repeats = 0;
+               if (rspamd_log->saved_message) {
+                       g_free (rspamd_log->saved_message);
+                       g_free (rspamd_log->saved_function);
+                       g_free (rspamd_log->saved_module);
+                       g_free (rspamd_log->saved_id);
+                       rspamd_log->saved_message = NULL;
+                       rspamd_log->saved_function = NULL;
+                       rspamd_log->saved_module = NULL;
+                       rspamd_log->saved_id = NULL;
+               }
+       }
 }
 
 /**