aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2026-03-24 10:58:53 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2026-03-24 10:58:53 +0000
commit828de702ada854b5f09f447ba06e4e08e976ba07 (patch)
tree23e13f66f17be5b61410ad8eb8ca5188d08e59d1
parent2e1cf242292a33a71839c512d222115d36f8fd40 (diff)
syslogd: Allow killing when in foreground
Normally, syslogd reacts only to SIGTERM, and ignores SIGINT and SIGQUIT unless in debug mode. Extend that to also apply when running in the foreground. Take this opportunity to comment the event loop. MFC after: 1 week Reviewed by: jfree Differential Revision: https://reviews.freebsd.org/D55886
-rw-r--r--usr.sbin/syslogd/syslogd.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 1b894ae54fc6..dcc74b1a93c1 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -781,15 +781,21 @@ main(int argc, char *argv[])
case EVFILT_SIGNAL:
switch (ev.ident) {
case SIGHUP:
+ /* Reload */
init(true);
break;
case SIGINT:
case SIGQUIT:
+ /* Ignore these unless -F and / or -d */
+ if (!Foreground && !Debug)
+ break;
+ /* FALLTHROUGH */
case SIGTERM:
- if (ev.ident == SIGTERM || Debug)
- die(ev.ident);
+ /* Terminate */
+ die(ev.ident);
break;
case SIGALRM:
+ /* Mark and flush */
markit();
break;
}