diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2004-05-29 23:24:18 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2004-05-29 23:24:18 +0000 |
commit | daa2b936bfecabf39ab968645507814452f61b46 (patch) | |
tree | 53b112bd93a0ba92cab3e8705f3bcd1c5f8b87a2 /usr.sbin/syslogd | |
parent | fa9a8a76e40aacdac41191bb7ddb738f29636720 (diff) | |
download | FreeBSD-src-daa2b936bfecabf39ab968645507814452f61b46.zip FreeBSD-src-daa2b936bfecabf39ab968645507814452f61b46.tar.gz |
Fix some bugs that don't manifest themselves in practice.
1) Don't check for getopt returning '?', we have a default case.
2) Check if the priority is LOG_KERN correctly - in practice
LOG_KERN is 0, so it makes no difference. OpenBSD fixed a
different nearby bug that we don't have 'cos our definition
of LOG_MAKEPRI is different to OpenBSD's.
Copy a comment from OpenBSD, observing that LOG_KERN is 0.
Inspired by PR: 67139
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 1c9086b..50adb62 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -401,7 +401,6 @@ main(int argc, char *argv[]) case 'v': /* log facility and priority */ LogFacPri++; break; - case '?': default: usage(); } @@ -664,8 +663,12 @@ printline(const char *hname, char *msg) if (pri &~ (LOG_FACMASK|LOG_PRIMASK)) pri = DEFUPRI; - /* don't allow users to log kernel messages */ - if (LOG_FAC(pri) == LOG_KERN && !KeepKernFac) + /* + * Don't allow users to log kernel messages. + * NOTE: since LOG_KERN == 0 this will also match + * messages with no facility specified. + */ + if ((pri & LOG_FACMASK) == LOG_KERN && !KeepKernFac) pri = LOG_MAKEPRI(LOG_USER, LOG_PRI(pri)); q = line; |