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:
parent
8e255b7f9d
commit
05c5b6752d
@ -449,12 +449,8 @@ int main(int argc, char *argv[])
|
|||||||
/*
|
/*
|
||||||
* Tell system we're up and running by creating /run/syslogd.pid
|
* 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));
|
logit("Failed creating %s: %s", PidFile, strerror(errno));
|
||||||
if (getpid() != ppid)
|
|
||||||
kill(ppid, SIGTERM);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Main loop begins here. */
|
/* Main loop begins here. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -466,8 +462,9 @@ int main(int argc, char *argv[])
|
|||||||
logit("\nReceived SIGHUP, reloading syslogd.\n");
|
logit("\nReceived SIGHUP, reloading syslogd.\n");
|
||||||
init();
|
init();
|
||||||
|
|
||||||
if (!Debug && pidfile(PidFile))
|
/* Acknowledge SIGHUP by touching our PID file */
|
||||||
ERR("Failed writing %s", PidFile);
|
if (pidfile(PidFile))
|
||||||
|
ERR("Failed touching %s", PidFile);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user