[syslog-ng] [PATCH] lib/gprocess.c: Ignore SIGHUP inside the supervisor.

Gergely Nagy algernon at balabit.hu
Fri May 4 10:41:11 CEST 2012


Reloading syslog-ng's config is often done via a killall -HUP
syslog-ng command, which also sends a signal to the
supervisor. However, the supervisor did not handle said signal, thus
it exited as is the default for it.

To work around this issue, lets ignore SIGHUP inside the supervisor.

Reported-by: Patrick Hemmer
Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 lib/gprocess.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/gprocess.c b/lib/gprocess.c
index aaefbab..d68521d 100644
--- a/lib/gprocess.c
+++ b/lib/gprocess.c
@@ -1055,10 +1055,15 @@ g_process_perform_supervise(void)
   pid_t pid;
   gboolean first = TRUE, exited = FALSE;
   gchar proc_title[PROC_TITLE_SPACE];
+  struct sigaction sa;
 
   g_snprintf(proc_title, PROC_TITLE_SPACE, "supervising %s", process_opts.name);
   g_process_setproctitle(proc_title);
   
+  memset(&sa, 0, sizeof(sa));
+  sa.sa_handler = SIG_IGN;
+  sigaction(SIGHUP, &sa, NULL);
+
   while (1)
     {
       if (pipe(init_result_pipe) != 0)
-- 
1.7.10




More information about the syslog-ng mailing list