Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2026 10:59:06 +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-main@FreeBSD.org
Subject:   git: 828de702ada8 - main - syslogd: Allow killing when in foreground
Message-ID:  <69c26e7a.36617.4648dbbe@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=828de702ada854b5f09f447ba06e4e08e976ba07

commit 828de702ada854b5f09f447ba06e4e08e976ba07
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-03-24 10:58:53 +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
---
 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 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;
 			}


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69c26e7a.36617.4648dbbe>