From d3c5093a3ca98246d2036db36db5e9648c3e3345 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 12 Jun 2015 14:59:42 -0700 Subject: [PATCH] logd: regression in log_strtok_r In commit 'logd: fix kernel logline stutter' 2c3b300fd8307e8da13608197d0a89bc613de5fb we introduced log_strtok_r. as a replacement for strtok_r that dealt with a problem with some kernel log messages. Fix is to refine definition of is_timestamp to not match on patterns like [0]. Change-Id: I0867a555a3bca09bbf18d18e75e41dffffe57a22 --- logd/LogKlog.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp index 7d1464899..4e0e89611 100644 --- a/logd/LogKlog.cpp +++ b/logd/LogKlog.cpp @@ -68,6 +68,9 @@ static char *is_timestamp(char *s) { continue; } if (!isdigit(c) && (c == ']')) { + if (first_period || (*s != ' ')) { + break; + } return s; } } @@ -75,7 +78,7 @@ static char *is_timestamp(char *s) { } // Like strtok_r with "\r\n" except that we look for log signatures (regex) -// \(\(<[0-9]+>\)\([[] *[0-9]+[]]\)\{0,1\}\|[[] *[0-9]+[]]\) +// \(\(<[0-9]+>\)\([[] *[0-9]+[.][0-9]+[]] \)\{0,1\}\|[[] *[0-9]+[.][0-9]+[]] \) // and split if we see a second one without a newline. #define SIGNATURE_MASK 0xF0