diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-24 08:33:49 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-24 08:33:49 +0100 |
commit | e853ac873adbf4730f5c6593a410da310df35cac (patch) | |
tree | 84d8a6cdf1af332f96ffbbec1826953d16a3a729 /src/rspamd.c | |
parent | 6b71fcb72fce2945cca43cc2acc141b507655273 (diff) | |
download | rspamd-e853ac873adbf4730f5c6593a410da310df35cac.tar.gz rspamd-e853ac873adbf4730f5c6593a410da310df35cac.zip |
[Minor] Store parent pid inside workers
Diffstat (limited to 'src/rspamd.c')
-rw-r--r-- | src/rspamd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/rspamd.c b/src/rspamd.c index 080ceef6c..59bbb0144 100644 --- a/src/rspamd.c +++ b/src/rspamd.c @@ -687,6 +687,10 @@ wait_for_workers (gpointer key, gpointer value, gpointer unused) rspamd_main = w->srv; + if (w->ppid != getpid ()) { + return TRUE; + } + if (waitpid (w->pid, &res, WNOHANG) <= 0) { if (term_attempts < 0) { if (w->cf->worker->flags & RSPAMD_WORKER_KILLABLE) { @@ -1023,12 +1027,22 @@ rspamd_cld_handler (gint signo, short what, gpointer arg) } } - event_del (&cur->srv_ev); - /* We also need to clean descriptors left */ - close (cur->control_pipe[0]); - close (cur->srv_pipe[0]); + if (cur->srv_pipe[0] != -1) { + event_del (&cur->srv_ev); + } + + if (cur->control_pipe[0] != -1) { + /* We also need to clean descriptors left */ + close (cur->control_pipe[0]); + close (cur->srv_pipe[0]); + } + REF_RELEASE (cur->cf); - g_ptr_array_free (cur->finish_actions, TRUE); + + if (cur->finish_actions) { + g_ptr_array_free (cur->finish_actions, TRUE); + } + g_free (cur); } else { |