]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
dmesg: Delete redundant pager setup
authorKarel Zak <kzak@redhat.com>
Tue, 11 Jul 2023 09:40:39 +0000 (11:40 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Jul 2023 09:40:39 +0000 (11:40 +0200)
The pager is necessary only for SYSLOG_ACTION_READ* actions (print
kernel messages). Let's remove redundant global initialization.

Based on patch from Dragan Simic.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c

index 02358e449e5603424583d84a1cab37486a5e340e..59b79245b4afc82bd58daca178789fb7493df7ae 100644 (file)
@@ -1607,7 +1607,7 @@ int main(int argc, char *argv[])
                        ctl.suspended_time = dmesg_get_suspended_time();
        }
 
-       if (delta)
+       if (delta) {
                switch (ctl.time_fmt) {
                case DMESG_TIMEFTM_CTIME:
                        ctl.time_fmt = DMESG_TIMEFTM_CTIME_DELTA;
@@ -1621,15 +1621,13 @@ int main(int argc, char *argv[])
                default:
                        ctl.time_fmt = DMESG_TIMEFTM_DELTA;
                }
-
+       }
 
        if (!ctl.json)
                ctl.color = colors_init(colormode, "dmesg") ? 1 : 0;
        if (ctl.follow)
                nopager = 1;
        ctl.pager = nopager ? 0 : ctl.pager;
-       if (ctl.pager)
-               pager_redirect();
 
        switch (ctl.action) {
        case SYSLOG_ACTION_READ_ALL: