util-linux/backport-logger-fix-prio-prefix-doesnot-use-priority-default.patch
2023-11-28 16:33:43 +08:00

38 lines
1.2 KiB
Diff

From 02f859392754038f383dabeb32effec4ae1f02ba 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 a7736eb..4120871 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -1003,8 +1003,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;
--
2.27.0