From: Karel Zak Date: Thu, 16 Sep 2021 10:20:25 +0000 (+0200) Subject: logger: fix --prio-prefix doesn't use --priority default X-Git-Tag: v2.38-rc1~256 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=02f859392754038f383dabeb32effec4ae1f02ba;p=thirdparty%2Futil-linux.git logger: fix --prio-prefix doesn't use --priority default The commit b9ef27f have added priority check, but it introduced regression as the default priority (as specified by --priority) is ignored. This patch fixes this problem, but it also removes extra check for "kern facility", it's unnecessary and inconsistent with the rest of logger. Fixes: https://github.com/karelzak/util-linux/issues/1450 Signed-off-by: Karel Zak --- diff --git a/misc-utils/logger.c b/misc-utils/logger.c index 40ef043be4..599a43a1ba 100644 --- a/misc-utils/logger.c +++ b/misc-utils/logger.c @@ -998,8 +998,8 @@ static void logger_stdin(struct logger_ctl *ctl) if (c == '>' && 0 <= pri && pri <= 191) { /* valid RFC PRI values */ i = 0; - if (pri < 8) /* kern facility is forbidden */ - pri |= 8; + if ((pri & LOG_FACMASK) == 0) + pri |= (default_priority & LOG_FACMASK); ctl->pri = pri; } else ctl->pri = default_priority;