git: 25b35dc82b46 - stable/15 - syslogd: Allow killing when in foreground

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 02 Apr 2026 09:56:52 UTC
The branch stable/15 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=25b35dc82b467efada14ff2892d4460f0b3716f0

commit 25b35dc82b467efada14ff2892d4460f0b3716f0
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-03-24 10:58:53 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-02 09:51:00 +0000

    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
    
    (cherry picked from commit 828de702ada854b5f09f447ba06e4e08e976ba07)
---
 usr.sbin/syslogd/syslogd.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 20051bb4fa00..ee15fa70807d 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;
 			}