syslogd: Install SIGHUP handler earlier

When a heavily loaded system starts up syslogd may not in time reach its
original installation of the SIGHUP handler before receiving the signal.
It will then die and have to be restarted by PID 1.

This patch installs the SIGHUP handler early, with all the other signals
right after command line parsing.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-11-08 16:15:29 +01:00
parent 9ed0fe672a
commit 9aaa7ec8c4

View File

@ -387,6 +387,7 @@ int main(int argc, char *argv[])
(void)signal(SIGALRM, domark);
(void)signal(SIGUSR1, Debug ? debug_switch : SIG_IGN);
(void)signal(SIGXFSZ, SIG_IGN);
(void)signal(SIGHUP, sighup_handler);
LastAlarm = MarkInterval;
alarm(LastAlarm);
@ -2373,7 +2374,6 @@ void init(void)
else
flog(LOG_SYSLOG | LOG_INFO, "syslogd v" VERSION ": restart.");
(void)signal(SIGHUP, sighup_handler);
logit("syslogd: restarted.\n");
}