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
This commit is contained in:
Dag-Erling Smørgrav committed 2026-03-24 11:58:53 +01:00
1 parent 2e1cf24229
commit 828de702ad
1 file changed
+8 -2
+8 -2
View File
@@ -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;
}