Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Apr 2026 09:56:52 +0000
From:      Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 25b35dc82b46 - stable/15 - syslogd: Allow killing when in foreground
Message-ID:  <69ce3d64.3bdb5.50de29ad@gitrepo.freebsd.org>

index | next in thread | raw e-mail

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;
 			}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69ce3d64.3bdb5.50de29ad>