From nobody Thu Sep 28 15:52:31 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 4RxHzz5jRkz4tyQl; Thu, 28 Sep 2023 15:52:31 +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 4RxHzz4nvDz4KNV; Thu, 28 Sep 2023 15:52:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695916351; 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=GXOhWIiMgFhyH2QGFj7XiWIrXiLIyv0Faq8G7088A6o=; b=GWh5D3y5EY1AfBMvsQtlwsbzzMtBGxNwAntU3NlpjY95SD8BBtN9iunELbyVJL8jaRI03T 24bGlhW5TXBln9MCkJxlDdXjYATez5LIPPR62os2C/ufW2sje2w1Ick8/XdEAW8iNnhWci W1rrxuF6WVif5JdBZ0FsfiPHKbO829+vBfNuO1NON1fOEs5E5rcNMiEBb/WpdEQ1bYNK3U PK0on5/Qh/2u69F/sZx6Vh+tinmiysVZ8aSW45TBt4cXqsrmZQJwiu5QIcG/cC/uyL5MQq ZGiLxnIFvw8wIZFcBuWXH2KwwZz1tynrsq/EmamP6T9V+ax36pNgdkofX33U2g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695916351; a=rsa-sha256; cv=none; b=TKKhWpdmaXkzyHwaWBjh6TmrChH0rHvRJjQAtnYOu9n2MCR1Bj1dQUWvznb76SO8CCnFQl JMXfXVfMcBggOuUYQeX8EJ4giEzYdDHSY3f7jiY0kdE+jIJNSG7S37hW82ILq6dfyGv67l h+Qj8jJhLip7Q0bjm8Ge5/iOABZbEiUzNlz6SipTMgSHgujYtYSAUsePdN+82wPG23wJ8g bbrAXWqrVaus98E2C8cRpUfkRpNrIZ6DrpVt7y84w24XNfAk+SejQFLnAe5w53J4qETOgB lmSmH9olQWWcTJVS/GsVvbm+/OiBTN5R2oQ0sGufWALCz7Syp+/VIK5RFOKfyA== 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=1695916351; 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=GXOhWIiMgFhyH2QGFj7XiWIrXiLIyv0Faq8G7088A6o=; b=GIKwmst0p1CPzgmGhirJvHFc8W5uLNQjV2LkF0OHCokuch2AvnoDTBS0ZcGCQgJ9aJEyWF TRQpS8w4vhdm3s64qIerpMkCOri5+yrT+MsMoAmQvvDsjRzV78rt0KQReqHY4qbZJWX+RP Ki1eTwudEkGhM5hAPis7CzfMcufBJo/zv65f3RnptnhvbwicBIndvpwYLjY2Qap4PpB+57 GWiRpm4vfXAYdwLQmot6I+inOAK+kWdWtcbFY50yugLymiw8ZA8W37CN5PGr38rpVQN90m R+t+0fpmSLlDiC8LEwaeZXtnaUqnNXTLqCZdeT5g+wEj//uviziPPcjdlpPrYA== 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 4RxHzz3tnMzDL5; Thu, 28 Sep 2023 15:52:31 +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 38SFqVOu021899; Thu, 28 Sep 2023 15:52:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38SFqVeW021896; Thu, 28 Sep 2023 15:52:31 GMT (envelope-from git) Date: Thu, 28 Sep 2023 15:52:31 GMT Message-Id: <202309281552.38SFqVeW021896@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: 929568b9d527 - main - syslogd: Style fixes 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: 929568b9d52739679965e81b7d2f19b2d209479e Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=929568b9d52739679965e81b7d2f19b2d209479e commit 929568b9d52739679965e81b7d2f19b2d209479e Author: Jake Freeland AuthorDate: 2023-09-01 02:50:03 +0000 Commit: Mark Johnston CommitDate: 2023-09-28 15:51:53 +0000 syslogd: Style fixes Reviewed by: markj, emaste MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D41367 --- usr.sbin/syslogd/syslogd.c | 52 ++++++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index d1027773494f..22ba9deaa5d8 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -133,6 +133,7 @@ static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #include #include #include +#include #include #include #include @@ -142,7 +143,6 @@ static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94"; #include #include #include -#include #include "pathnames.h" #include "ttymsg.h" @@ -372,8 +372,14 @@ static int repeatinterval[] = { 30, 120, 600 }; /* # of secs before flush */ } while (0) static const char *TypeNames[] = { - "UNUSED", "FILE", "TTY", "CONSOLE", - "FORW", "USERS", "WALL", "PIPE" + "UNUSED", + "FILE", + "TTY", + "CONSOLE", + "FORW", + "USERS", + "WALL", + "PIPE", }; static const int sigcatch[] = { @@ -1480,7 +1486,7 @@ skip_message(const char *name, const char *spec, int checkcase) /* Behaviour on explicit match */ if (spec == NULL) - return 0; + return (0); switch (*spec) { case '-': exclude = 1; @@ -1503,12 +1509,12 @@ skip_message(const char *name, const char *spec, int checkcase) if (prev == ',' && (next == '\0' || next == ',')) /* Explicit match: skip iff the spec is an exclusive one. */ - return exclude; + return (exclude); } /* No explicit match for this name: skip the message iff the spec is an inclusive one. */ - return !exclude; + return (!exclude); } /* @@ -1760,8 +1766,8 @@ dofsync(void) struct filed *f; STAILQ_FOREACH(f, &fhead, next) { - if ((f->f_type == F_FILE) && - (f->f_flags & FFLAG_NEEDSYNC)) { + if (f->f_type == F_FILE && + (f->f_flags & FFLAG_NEEDSYNC) != 0) { f->f_flags &= ~FFLAG_NEEDSYNC; (void)fsync(f->f_file); } @@ -2243,7 +2249,7 @@ ttymsg_check(struct iovec *iov, int iovcnt, char *line, int tmout) if ((sb.st_mode & S_IWGRP) == 0) /* Messages disabled. */ return (NULL); - return ttymsg(iov, iovcnt, line, tmout); + return (ttymsg(iov, iovcnt, line, tmout)); } static void @@ -2398,7 +2404,7 @@ parseconfigfile(FILE *cf, bool allow_includes) /* * Foreach line in the conf table, open that file. */ - include_len = sizeof(include_str) -1; + include_len = sizeof(include_str) - 1; (void)strlcpy(host, "*", sizeof(host)); (void)strlcpy(prog, "*", sizeof(prog)); (void)strlcpy(pfilter, "*", sizeof(pfilter)); @@ -2410,7 +2416,7 @@ parseconfigfile(FILE *cf, bool allow_includes) */ for (p = cline; isspace(*p); ++p) continue; - if (*p == 0) + if (*p == '\0') continue; if (allow_includes && strncmp(p, include_str, include_len) == 0 && @@ -2457,7 +2463,7 @@ parseconfigfile(FILE *cf, bool allow_includes) host[0] = *p++; while (isspace(*p)) p++; - if ((!*p) || (*p == '*')) { + if (*p == '\0' || *p == '*') { (void)strlcpy(host, "*", sizeof(host)); continue; } @@ -2474,8 +2480,9 @@ parseconfigfile(FILE *cf, bool allow_includes) } if (*p == '!') { p++; - while (isspace(*p)) p++; - if ((!*p) || (*p == '*')) { + while (isspace(*p)) + p++; + if (*p == '\0' || *p == '*') { (void)strlcpy(prog, "*", sizeof(prog)); continue; } @@ -2484,14 +2491,14 @@ parseconfigfile(FILE *cf, bool allow_includes) break; prog[i] = p[i]; } - prog[i] = 0; + prog[i] = '\0'; continue; } if (*p == ':') { p++; while (isspace(*p)) p++; - if ((!*p) || (*p == '*')) { + if (*p == '\0' || *p == '*') { (void)strlcpy(pfilter, "*", sizeof(pfilter)); continue; } @@ -2754,11 +2761,11 @@ prop_filter_compile(struct prop_filter *pfilter, char *filter) /* fill in prop_type */ if (strcasecmp(argv[0], "msg") == 0) pfilter->prop_type = FILT_PROP_MSG; - else if(strcasecmp(argv[0], "hostname") == 0) + else if (strcasecmp(argv[0], "hostname") == 0) pfilter->prop_type = FILT_PROP_HOSTNAME; - else if(strcasecmp(argv[0], "source") == 0) + else if (strcasecmp(argv[0], "source") == 0) pfilter->prop_type = FILT_PROP_HOSTNAME; - else if(strcasecmp(argv[0], "programname") == 0) + else if (strcasecmp(argv[0], "programname") == 0) pfilter->prop_type = FILT_PROP_PROGNAME; else { logerror("unknown property"); @@ -2868,10 +2875,11 @@ cfline(const char *line, const char *prog, const char *host, { struct filed *f; struct addrinfo hints, *res; - int error, i, pri, syncfile; + int error, i, pri; const char *p, *q; char *bp, *pfilter_dup; char buf[LINE_MAX], ebuf[100]; + bool syncfile; dprintf("cfline(\"%s\", f, \"%s\", \"%s\", \"%s\")\n", line, prog, host, pfilter); @@ -3048,10 +3056,10 @@ cfline(const char *line, const char *prog, const char *host, p++; if (*p == '-') { - syncfile = 0; + syncfile = false; p++; } else - syncfile = 1; + syncfile = true; switch (*p) { case '@':