Fix issue with parsing /dev/kmsg time, off by one error

Problem and proposed fix reported by opty on #troglobit at freenode.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg 2021-02-21 11:46:09 +01:00
parent b115c7ec4e
commit f54c1d1f30

View File

@ -1128,8 +1128,8 @@ void printsys(char *msg)
while (isdigit(*++p)) while (isdigit(*++p))
; ;
++p; ++p;
while (isdigit(*++p)) while (isdigit(*p))
buffer.timestamp.usec = 10 * buffer.timestamp.usec + (*p - '0'); buffer.timestamp.usec = 10 * buffer.timestamp.usec + (*p++ - '0');
now += buffer.timestamp.usec / 1000000; now += buffer.timestamp.usec / 1000000;
buffer.timestamp.usec = buffer.timestamp.usec % 1000000; buffer.timestamp.usec = buffer.timestamp.usec % 1000000;
localtime_r(&now, &buffer.timestamp.tm); localtime_r(&now, &buffer.timestamp.tm);