Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Sep 2023 15:52:26 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1bb61348e69e - main - syslogd: Use boolean reload parameter for init()
Message-ID:  <202309281552.38SFqQGS021720@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=1bb61348e69e6facc1fbac49d82236218028eeb8

commit 1bb61348e69e6facc1fbac49d82236218028eeb8
Author:     Jake Freeland <jfree@FreeBSD.org>
AuthorDate: 2023-09-01 02:49:36 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-09-28 15:51:52 +0000

    syslogd: Use boolean reload parameter for init()
    
    Replace init()'s integer "signo" parameter with boolean "reload"
    for clarity.
    
    Reviewed by:    markj, emaste
    MFC after:      3 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D41416
---
 usr.sbin/syslogd/syslogd.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index 21e2d48b0c37..b61a10c20aca 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -434,7 +434,7 @@ static void	fprintlog_first(struct filed *, const char *, const char *,
     const char *, const char *, const char *, const char *, int);
 static void	fprintlog_write(struct filed *, struct iovlist *, int);
 static void	fprintlog_successive(struct filed *, int);
-static void	init(int);
+static void	init(bool);
 static void	logerror(const char *);
 static void	logmsg(int, const struct logtime *, const char *, const char *,
     const char *, const char *, const char *, const char *, int);
@@ -2493,7 +2493,7 @@ readconfigfile(const char *path)
  *  INIT -- Initialize syslogd from configuration table
  */
 static void
-init(int signo)
+init(bool reload)
 {
 	int i;
 	struct filed *f;
@@ -2507,7 +2507,7 @@ init(int signo)
 	/*
 	 * Load hostname (may have changed).
 	 */
-	if (signo != 0)
+	if (reload)
 		(void)strlcpy(oldLocalHostName, LocalHostName,
 		    sizeof(oldLocalHostName));
 	if (gethostname(LocalHostName, sizeof(LocalHostName)))
@@ -2651,9 +2651,9 @@ init(int signo)
 	    NULL, NULL, "restart", 0);
 	dprintf("syslogd: restarted\n");
 	/*
-	 * Log a change in hostname, but only on a restart.
+	 * Log a change in hostname, but only on reload.
 	 */
-	if (signo != 0 && strcmp(oldLocalHostName, LocalHostName) != 0) {
+	if (reload && strcmp(oldLocalHostName, LocalHostName) != 0) {
 		(void)snprintf(hostMsg, sizeof(hostMsg),
 		    "hostname changed, \"%s\" to \"%s\"",
 		    oldLocalHostName, LocalHostName);
@@ -2663,9 +2663,9 @@ init(int signo)
 	}
 	/*
 	 * Log the kernel boot file if we aren't going to use it as
-	 * the prefix, and if this is *not* a restart.
+	 * the prefix, and if this is *not* a reload.
 	 */
-	if (signo == 0 && !use_bootfile) {
+	if (!reload && !use_bootfile) {
 		(void)snprintf(bootfileMsg, sizeof(bootfileMsg),
 		    "kernel boot file is %s", bootfile);
 		logmsg(LOG_KERN | LOG_INFO, NULL, LocalHostName, "syslogd",



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202309281552.38SFqQGS021720>