summaryrefslogtreecommitdiffstats
path: root/sys-utils/dmesg.c
diff options
context:
space:
mode:
authorKarel Zak2014-01-07 17:41:42 +0100
committerKarel Zak2014-01-07 17:41:42 +0100
commit1a38ad5c3271a59c7e51580242a2fbd3b0f16495 (patch)
treed399c39d6728f796ce0c3d5e8a61ba335015e717 /sys-utils/dmesg.c
parentuuidd: use pkg-config to find systemd-deamon support (diff)
downloadkernel-qcow2-util-linux-1a38ad5c3271a59c7e51580242a2fbd3b0f16495.tar.gz
kernel-qcow2-util-linux-1a38ad5c3271a59c7e51580242a2fbd3b0f16495.tar.xz
kernel-qcow2-util-linux-1a38ad5c3271a59c7e51580242a2fbd3b0f16495.zip
dmesg: fix --raw zero timestamp for kmsg
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1049438 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils/dmesg.c')
-rw-r--r--sys-utils/dmesg.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 5039fe7da..ec39612fb 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1220,10 +1220,15 @@ int main(int argc, char *argv[])
};
static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */
- { 'C','D','E','c','n' }, /* clear,off,on,read-clear,level*/
+ { 'C','D','E','c','n','r' }, /* clear,off,on,read-clear,level,raw*/
{ 'H','r' }, /* human, raw */
{ 'L','r' }, /* color, raw */
{ 'S','w' }, /* syslog,follow */
+ { 'T','r' }, /* ctime, raw */
+ { 'd','r' }, /* delta, raw */
+ { 'e','r' }, /* reltime, raw */
+ { 'r','x' }, /* raw, decode */
+ { 'r','t' }, /* notime, raw */
{ 0 }
};
int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT;
@@ -1300,8 +1305,6 @@ int main(int argc, char *argv[])
break;
case 'r':
ctl.raw = 1;
- ctl.time_fmt = DMESG_TIMEFTM_NONE;
- delta = 0;
break;
case 'S':
ctl.method = DMESG_METHOD_SYSLOG;
@@ -1371,11 +1374,6 @@ int main(int argc, char *argv[])
ctl.time_fmt = DMESG_TIMEFTM_DELTA;
}
- if (ctl.raw
- && (ctl.fltr_lev || ctl.fltr_fac || ctl.decode
- || !is_timefmt(&ctl, NONE)))
- errx(EXIT_FAILURE, _("--raw can't be used together with level, "
- "facility, decode, delta, ctime or notime options"));
ctl.color = colors_init(colormode) ? 1 : 0;
if (ctl.follow)
@@ -1389,6 +1387,12 @@ int main(int argc, char *argv[])
case SYSLOG_ACTION_READ_CLEAR:
if (ctl.method == DMESG_METHOD_KMSG && init_kmsg(&ctl) != 0)
ctl.method = DMESG_METHOD_SYSLOG;
+
+ if (ctl.raw
+ && ctl.method != DMESG_METHOD_KMSG
+ && (ctl.fltr_lev || ctl.fltr_fac))
+ errx(EXIT_FAILURE, _("--raw could be used together with --level or "
+ "--facility only when read messages from /dev/kmsg"));
if (ctl.pager)
setup_pager();
n = read_buffer(&ctl, &buf);