]> git.ipfire.org Git - thirdparty/util-linux.git/commit
dmesg: fix console-level off-by-one
authorBjørn Mork <bjorn@mork.no>
Mon, 1 Oct 2012 23:54:49 +0000 (01:54 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Oct 2012 09:43:10 +0000 (11:43 +0200)
commit8c8fa302c10d646a49d1d7565cbb60c5356a60b3
treea25cbbdfbb92a897fc9f5fab0093ebab2226a889
parent018dfb0fe7fc65720332abd9d0e8bdffa89eaa5c
dmesg: fix console-level off-by-one

  commit f06ec64f dmesg; support level names (e.g. --console-level=alert)

introduced an off-by-one error.  The kernel will print messages with
a *higher* level than the console-level. The bug made it impossible to
set the level for debugging, like it is documented in e.g
Documentation/networking/netconsole.txt :

 nemi:/tmp# dmesg -n 8
 dmesg: unknown level '8'

And attempting to set the "emerg" level would result in an invalid 0 value:

 nemi:/tmp# dmesg -n emerg
 dmesg: klogctl failed: Invalid argument

Restoring the old behaviour for numeric levels, and mapping the level
names so that "dmesg -n debug" behaves as expected: logging everything
at level "debug" and higher.

[kzak@redhat.com: - add comment to parse_level()]

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c