Fix babeltrace-log get big line when the input file last line don't have enter
authorHui Zhu <teawater@gmail.com>
Tue, 11 Sep 2012 13:28:59 +0000 (09:28 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 Sep 2012 13:28:59 +0000 (09:28 -0400)
I got:
[Error] Line too large for packet size (32kB) (discarded)
When I input a file to babeltrace-log.
That is because the last line of the input file doesn't have enter and
"babeltrace-log" have bug with the line that doesn't have enter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace-log.c

index 7f31d015226548969abfa515046ece454732dce9..f7eb5f768d39c88425f3bff276374f8ba47e9074 100644 (file)
@@ -240,9 +240,12 @@ void trace_text(FILE *input, int output)
                if (len < 0)
                        break;
                nl = strrchr(line, '\n');
                if (len < 0)
                        break;
                nl = strrchr(line, '\n');
-               if (nl)
+               if (nl) {
                        *nl = '\0';
                        *nl = '\0';
-               trace_string(line, &pos, nl - line + 1);
+                       trace_string(line, &pos, nl - line + 1);
+               } else {
+                       trace_string(line, &pos, strlen(line) + 1);
+               }
        }
        ctf_fini_pos(&pos);
 }
        }
        ctf_fini_pos(&pos);
 }
This page took 0.024821 seconds and 4 git commands to generate.