]> git.itanic.dy.fi Git - log-plotter/commitdiff
Discard too short log lines
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 7 Oct 2013 18:08:56 +0000 (21:08 +0300)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Mon, 7 Oct 2013 18:08:56 +0000 (21:08 +0300)
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 <timo.t.kokkonen@iki.fi>
main.c

diff --git a/main.c b/main.c
index 776f81ee5036bb054f3ff6e732ac9c6d93ecd86e..8e145218aa4e463c88e5ecbf33914cae58c93655 100644 (file)
--- 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);