From nobody Thu Sep 28 15:52:24 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RxHzs28Shz4tyJZ; Thu, 28 Sep 2023 15:52:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RxHzs07mJz4K9D; Thu, 28 Sep 2023 15:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695916345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iJqxrK3YWzrxT0MMww6hqfQcIRatvNUuJ7zZdzTnASI=; b=GEFCbD742Nr5Yty55+qZTE/TUj/i7NOcDgjgdotS9rbvQlC1dkuQsENimnKlfaRBo5tfpC 5L0dIi+bNR04LnLgHMPF6ddeYkNQDpO4rSVSLivJcibKy/5eUaIWC0SvJx/wMGsja6O5s9 ywbMWTjy7FxKEXBV6008G9naIrsZVzsOBssMUj942j+0cUlQoKNKDgX6GSuIH0fmL8I12Q bUWIj3CMkNIdiwOyldeZi15SyDGFT6n/zx7jZl5H6LKnHsOz7b3UGRq3W7YYUjGi8R8v+B ni+21kPfp3QeRdPCzqO+5imWDL2YgYmVCsyDK5UVFPbI7mCMKnmUmhaSavHCSw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695916345; a=rsa-sha256; cv=none; b=JChd1+MFeoRc3ZZv2iemOLT4GIYOkDeLsI6tGRx9jlAc/l3oj4NxG2Quv6ivq0zbE8a/Vl Z5ZN07Je9XEWVt+NTt3IC8Er9doLbXJE46Tb5LDolJstAn/SyCAsjXUDQ1rvVnG0iwwvl1 tJv0k3DQThkrVBrmsJiOGRGXP82Hj1s6HDApexrCIxYEo2fGRLzgupLD1vOt5mc53FOahs bhBfgaJ+ZTIQ9bADWq0cqB1OrIj8JPcI4R1fbjvwIpRgvuND+LyTXWyK/nX434Rpoj96Xs oROnBjPhtlLwWWZkuJ2A8p0yiS8rqVe7MoheFRbQwiySvdWMsR4qmemQHfz8pA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695916345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iJqxrK3YWzrxT0MMww6hqfQcIRatvNUuJ7zZdzTnASI=; b=T9x33+jaoWk7iYVdpcurQjgoaZjqwo0MufyIDVzRm3ns3lZ2SAG5W8PLLeBA9BqtQBo8Qu qgPZp9rg9qB0XJPRQWD0M4GZ3oucn68IimvjYFEXYJV8kQFS52uw22IGNZIeWUkviqjuJ2 N/rp9ZybV1txSg52UnoWj/U9s6WYTXMQTXSyL4WnrMX4ep872abefovdNEzigN0ngjmyjC CJpnNYI9QfgovrBZguSs+CIZhrlAXts0TW1Wh69trqfoBKcjnN+z4oPh2Vq8UpBfmjWNpe n1N0A7BeYvysN6M8jkWnPB/weLdPSU+xvZXQCBGENwW5sseRwDCSQ0hrGpA+/w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RxHzr5l52zCqR; Thu, 28 Sep 2023 15:52:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38SFqOkT021626; Thu, 28 Sep 2023 15:52:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SFqOrt021623; Thu, 28 Sep 2023 15:52:24 GMT (envelope-from git) Date: Thu, 28 Sep 2023 15:52:24 GMT Message-Id: <202309281552.38SFqOrt021623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 3f8b49dd1af1 - main - syslogd: Replace int with bool, where applicable List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f8b49dd1af1cff852d57c44096b24091a2930f8 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3f8b49dd1af1cff852d57c44096b24091a2930f8 commit 3f8b49dd1af1cff852d57c44096b24091a2930f8 Author: Jake Freeland AuthorDate: 2023-09-01 02:49:14 +0000 Commit: Mark Johnston CommitDate: 2023-09-28 15:51:52 +0000 syslogd: Replace int with bool, where applicable Many of syslogd's global configuration options are declared as integers but are treated as booleans. Declare those options as booleans instead. Reviewed by: markj, emaste MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41362 --- usr.sbin/syslogd/syslogd.c | 59 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 0f0a3cac1417..c8420298f117 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -371,15 +371,15 @@ static const char *TypeNames[] = { "FORW", "USERS", "WALL", "PIPE" }; -static int Debug; /* debug flag */ -static int Foreground = 0; /* Run in foreground, instead of daemonizing */ -static int resolve = 1; /* resolve hostname */ +static bool Debug; /* debug flag */ +static bool Foreground = false; /* Run in foreground, instead of daemonizing */ +static bool resolve = true; /* resolve hostname */ static char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */ static const char *LocalDomain; /* our local domain name */ -static int Initialized; /* set when we have initialized ourselves */ +static bool Initialized; /* set when we have initialized ourselves */ static int MarkInterval = 20 * 60; /* interval between marks in seconds */ static int MarkSeq; /* mark sequence number */ -static int NoBind; /* don't bind() as suggested by RFC 3164 */ +static bool NoBind; /* don't bind() as suggested by RFC 3164 */ static int SecureMode; /* when true, receive only unix domain socks */ static int MaxForwardLen = 1024; /* max length of forwared message */ #ifdef INET6 @@ -395,14 +395,14 @@ static int logflags = O_WRONLY|O_APPEND; /* flags used to open log files */ static char bootfile[MAXPATHLEN]; /* booted kernel file */ -static int RemoteAddDate; /* Always set the date on remote messages */ -static int RemoteHostname; /* Log remote hostname from the message */ +static bool RemoteAddDate; /* Always set the date on remote messages */ +static bool RemoteHostname; /* Log remote hostname from the message */ -static int UniquePriority; /* Only log specified priority? */ +static bool UniquePriority; /* Only log specified priority? */ static int LogFacPri; /* Put facility and priority in log message: */ /* 0=no, 1=numeric, 2=names */ -static int KeepKernFac; /* Keep remotely logged kernel facility */ -static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ +static bool KeepKernFac; /* Keep remotely logged kernel facility */ +static bool needdofsync = false; /* Are any file(s) waiting to be fsynced? */ static struct pidfh *pfh; static int sigpipe[2]; /* Pipe to catch a signal during select(). */ static bool RFC3164OutputFormat = true; /* Use legacy format by default. */ @@ -526,7 +526,8 @@ addsock(struct addrinfo *ai, struct socklist *sl0) int main(int argc, char *argv[]) { - int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; + int ch, i, s, fdsrmax = 0; + bool bflag = false, pflag = false, Sflag = false; fd_set *fdsr = NULL; struct timeval tv, *tvp; struct peer *pe; @@ -554,14 +555,14 @@ main(int argc, char *argv[]) mask_C1 = 0; break; case 'A': - send_to_all++; + send_to_all = true; break; case 'a': /* allow specific network addresses only */ if (allowaddr(optarg) == -1) usage(); break; case 'b': - bflag = 1; + bflag = true; p = strchr(optarg, ']'); if (p != NULL) p = strchr(p + 1, ':'); @@ -593,19 +594,19 @@ main(int argc, char *argv[]) logflags |= O_CREAT; break; case 'd': /* debug */ - Debug++; + Debug = true; break; case 'f': /* configuration file */ ConfFile = optarg; break; case 'F': /* run in foreground instead of daemon */ - Foreground++; + Foreground = true; break; case 'H': - RemoteHostname = 1; + RemoteHostname = true; break; case 'k': /* keep remote kern fac */ - KeepKernFac = 1; + KeepKernFac = true; break; case 'l': case 'p': @@ -619,10 +620,10 @@ main(int argc, char *argv[]) mode = DEFFILEMODE; else if (ch == 'p') { mode = DEFFILEMODE; - pflag = 1; + pflag = true; } else { mode = S_IRUSR | S_IWUSR; - Sflag = 1; + Sflag = true; } if (optarg[0] == '/') name = optarg; @@ -660,12 +661,12 @@ main(int argc, char *argv[]) MarkInterval = atoi(optarg) * 60; break; case 'N': - NoBind = 1; + NoBind = true; if (!SecureMode) SecureMode = 1; break; case 'n': - resolve = 0; + resolve = false; break; case 'O': if (strcmp(optarg, "bsd") == 0 || @@ -678,7 +679,7 @@ main(int argc, char *argv[]) usage(); break; case 'o': - use_bootfile = 1; + use_bootfile = true; break; case 'P': /* path for alt. PID */ PidFile = optarg; @@ -687,10 +688,10 @@ main(int argc, char *argv[]) SecureMode++; break; case 'T': - RemoteAddDate = 1; + RemoteAddDate = true; break; case 'u': /* only log specified priority */ - UniquePriority++; + UniquePriority = true; break; case 'v': /* log facility and priority */ LogFacPri++; @@ -793,7 +794,7 @@ main(int argc, char *argv[]) errx(1, "calloc fd_set"); for (;;) { - if (Initialized == 0) + if (!Initialized) init(0); else if (WantInitialize) init(WantInitialize); @@ -818,7 +819,7 @@ main(int argc, char *argv[]) switch (i) { case 0: dofsync(); - needdofsync = 0; + needdofsync = false; if (tvp) { tvp = NULL; if (ppid != 1) @@ -1917,7 +1918,7 @@ fprintlog_write(struct filed *f, struct iovlist *il, int flags) } } else if ((flags & SYNC_FILE) && (f->f_flags & FFLAG_SYNC)) { f->f_flags |= FFLAG_NEEDSYNC; - needdofsync = 1; + needdofsync = true; } break; @@ -2597,7 +2598,7 @@ init(int signo) /* * Close all open log files. */ - Initialized = 0; + Initialized = false; STAILQ_FOREACH(f, &fhead, next) { /* flush any pending output */ if (f->f_prevcount) @@ -2641,7 +2642,7 @@ init(int signo) } readconfigfile(ConfFile); - Initialized = 1; + Initialized = true; if (Debug) { int port;