util-linux/backport-logger-fix-prio-prefix-doesn-t-use-priority-default.patch

38 lines
1.2 KiB
Diff
Raw Normal View History

2022-06-20 17:29:05 +08:00
From dbe693413205ba2c3d06a42e85b47b1bd713bfee Mon Sep 17 00:00:00 2001
From: Karel Zak <kzak@redhat.com>
Date: Thu, 16 Sep 2021 12:20:25 +0200
Subject: [PATCH] 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 <kzak@redhat.com>
---
misc-utils/logger.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 5b122de..0e7ac8d 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -997,8 +997,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;
--
1.8.3.1