From d70f246f8a402024db325f15bdf398c9608d54cc Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 14 Mar 2017 15:25:46 -0700 Subject: logcat: test: tail_# occasional failures When PID becomes 5 digits, fgetLongTime fails Test: gTest logcat-unit-tests --gtest_filter=*.tail_* Bug: 27319267 Change-Id: I9cc636ed9955a317eb3b0ff0a820a50b800b7e0d --- logcat/tests/logcat_test.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/logcat/tests/logcat_test.cpp b/logcat/tests/logcat_test.cpp index dad74ee4b..0895834b2 100644 --- a/logcat/tests/logcat_test.cpp +++ b/logcat/tests/logcat_test.cpp @@ -208,9 +208,9 @@ static char* fgetLongTime(char* buffer, size_t buflen, FILE* fp) { if ((*ep != '-') && (*ep != '.')) { continue; } - // Find PID field + // Find PID field. Look for ': ' or ':[0-9][0-9][0-9]' while (((ep = strchr(ep, ':'))) && (*++ep != ' ')) { - ; + if (isdigit(ep[0]) && isdigit(ep[1]) && isdigit(ep[2])) break; } if (!ep) { continue; -- cgit v1.2.3