diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-01-22 12:45:35 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-01 22:29:28 -0500 |
commit | c42213e4b113cdea8062a30945d1101dc02a8d31 (patch) | |
tree | 408cb0a49c7b0e50dcd6f990abaf0023291da25f /trace-cmd.c | |
parent | 7ad960c1cc3ca0e73abc1ecfc97c46f46ba04197 (diff) |
trace-cmd: Do not read entire file in trace_empty()
The function to test if the trace is empty should stop when
it detects a line that is not empty, and report it.
It actually had a bug where it would reach the end of the file
and report that the trace was not empty.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'trace-cmd.c')
-rw-r--r-- | trace-cmd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/trace-cmd.c b/trace-cmd.c index a073017..d13cb15 100644 --- a/trace-cmd.c +++ b/trace-cmd.c | |||
@@ -696,8 +696,10 @@ static int trace_empty(void) | |||
696 | n = getline(&line, &size, fp); | 696 | n = getline(&line, &size, fp); |
697 | if (!line) | 697 | if (!line) |
698 | ret = 1; | 698 | ret = 1; |
699 | else if (line[0] != '#') | 699 | else if (line[0] != '#') { |
700 | ret = 0; | 700 | ret = 0; |
701 | break; | ||
702 | } | ||
701 | if (n < 0) | 703 | if (n < 0) |
702 | ret = 1; | 704 | ret = 1; |
703 | } while (line && n > 0); | 705 | } while (line && n > 0); |