From e5ee2446a04f6e84d61dccf5ff7fb9c52c9eff2e Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 6 May 2021 08:47:30 +0200 Subject: [PATCH] Follow-up to 92a4fb3: allow kernel log dupes around edge of seqno Although hihgly unlikely, if the kernel log sequence number (seqno) reaches the end of its MAX value (18446744073709551615) we allow for dupes to handle the wrap-around back to zero (0) in the counter. Signed-off-by: Joachim Wiberg --- src/syslogd.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/syslogd.c b/src/syslogd.c index 25d4216..79225f8 100644 --- a/src/syslogd.c +++ b/src/syslogd.c @@ -1187,9 +1187,15 @@ void printsys(char *msg) while (isdigit(*p)) seqno = 10 * seqno + (*p++ - '0'); - /* Check if logged already (we've been restarted) */ - if (sys_seqno > 0 && seqno <= sys_seqno) - return; + /* + * Check if logged already (we've been restarted) + * Account for wrap-around at 18446744073709551615 + */ + if (sys_seqno > 0 && seqno <= sys_seqno) { + /* allow dupes around the edge */ + if (sys_seqno < 18446744073709551000) + return; + } sys_seqno = seqno; p++; /* skip ',' */