From 5b5bb6500af4523d153306590d24032552cc17ed Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Mon, 7 Oct 2013 21:08:56 +0300 Subject: [PATCH] Discard too short log lines Some times the serial output contains incorrect entries, typically in the beginning of log acquicition. Discard them so that they don't clutter the log output. Signed-off-by: Timo Kokkonen --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 776f81e..8e14521 100644 --- a/main.c +++ b/main.c @@ -110,6 +110,12 @@ static int read_data(int infd, int outfd) if (ret == 0) continue; + if (strlen(buf) < 5) { + pr_debug("discarding truncated log entry\n"); + offset = 0; + continue; + } + cur_time = time(NULL); pr_info("%s\n", buf); -- 2.44.0