mirror of
https://github.com/sheumann/hush.git
synced 2024-12-24 12:29:47 +00:00
dmesg: handle multi-char log levels
Since Linux 3.5 (7ff9554bb5: printk: convert byte-buffer to variable-length record buffer), klog buffer can now contain log lines with multi-char loglevel indicators (<[0-9]+>) - So we can no longer just skip 3 bytes. Instead skip past the terminating '>' like util-linux does. function old new delta dmesg_main 266 280 +13 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 13/0) Total: 13 bytes Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
fb499c5752
commit
3917fa32dc
@ -59,16 +59,15 @@ int dmesg_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
int last = '\n';
|
int last = '\n';
|
||||||
int in = 0;
|
int in = 0;
|
||||||
|
|
||||||
/* Skip <#> at the start of lines */
|
/* Skip <[0-9]+> at the start of lines */
|
||||||
while (1) {
|
while (1) {
|
||||||
if (last == '\n' && buf[in] == '<') {
|
if (last == '\n' && buf[in] == '<') {
|
||||||
in += 3;
|
while (buf[in++] != '>' && in < len)
|
||||||
if (in >= len)
|
;
|
||||||
break;
|
} else {
|
||||||
}
|
last = buf[in++];
|
||||||
last = buf[in];
|
|
||||||
putchar(last);
|
putchar(last);
|
||||||
in++;
|
}
|
||||||
if (in >= len)
|
if (in >= len)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user