diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-03-31 06:07:04 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-03-31 06:07:04 -0400 |
commit | 755cbcd7ad8fb0d7ee59bc8a2b3ed87a5c18febe (patch) | |
tree | c7b1fc1417cabb6bbbb7e663d20bd9130564a156 | |
parent | d9b58d42c43c2c52a68fe368105d821607fab855 (diff) |
trace-cmd: Always append '.1' to output file in trace-cmd split
If a output file is specified, always append a '.1' to it.
This removes the confusion of where the output file is written to
and it could cause data to be overwritten that was not expected.
Reported-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-split.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/trace-split.c b/trace-split.c index 489e6cf..d3594ab 100644 --- a/trace-split.c +++ b/trace-split.c | |||
@@ -489,13 +489,12 @@ void trace_split (int argc, char **argv) | |||
489 | 489 | ||
490 | pevent = tracecmd_get_pevent(handle); | 490 | pevent = tracecmd_get_pevent(handle); |
491 | 491 | ||
492 | if (!output) { | 492 | if (!output) |
493 | if (repeat) | 493 | output = strdup(input_file); |
494 | output = strdup(input_file); | 494 | |
495 | else { | 495 | if (!repeat) { |
496 | output = malloc_or_die(strlen(input_file) + 3); | 496 | output = realloc(output, strlen(output) + 3); |
497 | sprintf(output, "%s.1", input_file); | 497 | strcat(output, ".1"); |
498 | } | ||
499 | } | 498 | } |
500 | 499 | ||
501 | current = start_ns; | 500 | current = start_ns; |