git: 29ec3907f193 - main - syslogd: Improve handling of configuration errors
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 16 Feb 2026 20:16:37 UTC
The branch main has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=29ec3907f193e205a1c2118c182ec43e51baf717
commit 29ec3907f193e205a1c2118c182ec43e51baf717
Author: Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-02-16 19:50:45 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-02-16 20:16:12 +0000
syslogd: Improve handling of configuration errors
Make parse_selector() print a warning to stderr and continue parsing the
config if it encounters an invalid facility or priority. Note that
because the parsing is done from a casper service, there isn't a good
mechanism to log errors; the warnings are visible only when syslogd is
started in debug mode.
Reported by: Doug Hardie <bc979@lafn.org>
MFC after: 1 week
Fixes: f4b4a10abb26 ("syslogd: Move selector parsing into its own function")
Reviewed by: jfree, jlduran, eugen, delphij
Differential Revision: https://reviews.freebsd.org/D55033
---
usr.sbin/syslogd/syslogd.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index f109fcd02563..1b894ae54fc6 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -2932,8 +2932,9 @@ parse_selector(const char *p, struct filed *f)
pri = decode(buf, prioritynames);
if (pri < 0) {
- dprintf("unknown priority name \"%s\"", buf);
- return (NULL);
+ warnx("unknown priority name \"%s\", setting to 'info'",
+ buf);
+ pri = LOG_INFO;
}
}
if (!pri_cmp)
@@ -2955,11 +2956,12 @@ parse_selector(const char *p, struct filed *f)
} else {
i = decode(buf, facilitynames);
if (i < 0) {
- dprintf("unknown facility name \"%s\"", buf);
- return (NULL);
+ warnx("unknown facility name \"%s\", ignoring",
+ buf);
+ } else {
+ f->f_pmask[i >> 3] = pri;
+ f->f_pcmp[i >> 3] = pri_cmp;
}
- f->f_pmask[i >> 3] = pri;
- f->f_pcmp[i >> 3] = pri_cmp;
}
while (*p == ',' || *p == ' ')
p++;