Fix #27: bug in /dev/kmsg priority parser, intrdocued in v2.2.0

This patch fixes a bug in the kernel log priority parser introduced in
v2.2.0 with the new support for /dev/kmsg, replacing /proc/kmsg which
has another format for the log priority.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2021-01-26 22:04:49 +01:00
parent 3c59234dab
commit d2444c720f

View File

@ -1120,8 +1120,9 @@ void printsys(char *msg)
/* Linux /dev/kmsg: "pri,seq#,msec,flag[,..];msg" */
time_t now = boot_time;
while (isdigit(*++p))
buffer.pri = 10 * buffer.pri + (*p - '0');
buffer.pri = 0;
while (isdigit(*p))
buffer.pri = 10 * buffer.pri + (*p++ - '0');
++p;
/* skip sequence number for now */
while (isdigit(*++p))