From d2444c720fa831cf371a72c57cd5735bdcb4f300 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Tue, 26 Jan 2021 22:04:49 +0100 Subject: [PATCH] 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 --- src/syslogd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/syslogd.c b/src/syslogd.c index ffa75b0..fe44874 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -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))