syslogd: Always create PID file, even in debug mode

We definitely want to be able to run syslogd in debug mode for extended
periods of time and still run under finit/systemd or similar, letting
users know we run as 'PID'.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson 2019-11-28 15:34:47 +01:00
parent 8e255b7f9d
commit 05c5b6752d

View File

@ -449,12 +449,8 @@ int main(int argc, char *argv[])
/*
* Tell system we're up and running by creating /run/syslogd.pid
*/
if (!Debug && pidfile(PidFile)) {
if (pidfile(PidFile))
logit("Failed creating %s: %s", PidFile, strerror(errno));
if (getpid() != ppid)
kill(ppid, SIGTERM);
exit(1);
}
/* Main loop begins here. */
for (;;) {
@ -466,8 +462,9 @@ int main(int argc, char *argv[])
logit("\nReceived SIGHUP, reloading syslogd.\n");
init();
if (!Debug && pidfile(PidFile))
ERR("Failed writing %s", PidFile);
/* Acknowledge SIGHUP by touching our PID file */
if (pidfile(PidFile))
ERR("Failed touching %s", PidFile);
continue;
}