[syslog-ng] [PATCH] lib/gprocess.c: Ignore SIGHUP inside the supervisor.
Balazs Scheidler
bazsi at balabit.hu
Tue May 1 13:39:50 CEST 2012
Hi,
On Fri, 2012-04-20 at 16:34 +0200, Gergely Nagy wrote:
> 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 | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/lib/gprocess.c b/lib/gprocess.c
> index aaefbab..9246d88 100644
> --- a/lib/gprocess.c
> +++ b/lib/gprocess.c
> @@ -1110,7 +1110,9 @@ g_process_perform_supervise(void)
> g_process_message("Initialization failed but the daemon did not exit, even when forced to, trying to recover; pid='%d'", pid);
> continue;
> }
> -
> +
> + sigignore(SIGHUP);
> +
sigignore() is deprecated, I'd prefer to use the sigaction() family of
functions, e.g.:
memset(&sa, 0, sizeof(sa));
sa.sa_handler = SIG_IGN;
sigaction(SIGHUP, &sa, NULL);
Also, wouldn't it make sense to move this signal setup code upwards, to
the first thing g_process_perform_supervise() does? Is there a
particular reason it is within the supervisor main loop?
--
Bazsi
More information about the syslog-ng
mailing list