]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
logger: fix --prio-prefix doesn't use --priority default
authorKarel Zak <kzak@redhat.com>
Thu, 16 Sep 2021 10:20:25 +0000 (12:20 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 16 Sep 2021 10:20:25 +0000 (12:20 +0200)
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

index 40ef043be4a882cfa2efdfccc90a5eed7a7911ea..599a43a1ba49bd8d7380889920a5c3ab28110ed4 100644 (file)
@@ -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;