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
This commit is contained in:
dwmalone 2004-05-29 23:24:18 +00:00
parent 0d7aef40cb
commit 3e85e78d9a

View File

@ -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;