diff options
| author | David Ahern <dsahern@gmail.com> | 2012-08-26 14:24:44 -0400 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-09-05 16:20:24 -0400 |
| commit | fceda7feb4a7822feee9662bc64968230d8f37bf (patch) | |
| tree | 29bb0db15bdec607251de80fbaaf5006443b3825 | |
| parent | 33d6aef5136075930f7e9a05175bf4f772d8428e (diff) | |
perf stat: Remove use of die/exit and handle errors
Allows perf to clean up properly on program termination.
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1346005487-62961-5-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
| -rw-r--r-- | tools/perf/builtin-stat.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index d53d8ab099b1..02f49eba677f 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
| @@ -428,7 +428,7 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
| 428 | 428 | ||
| 429 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { | 429 | if (forks && (pipe(child_ready_pipe) < 0 || pipe(go_pipe) < 0)) { |
| 430 | perror("failed to create pipes"); | 430 | perror("failed to create pipes"); |
| 431 | exit(1); | 431 | return -1; |
| 432 | } | 432 | } |
| 433 | 433 | ||
| 434 | if (forks) { | 434 | if (forks) { |
| @@ -510,7 +510,8 @@ static int run_perf_stat(int argc __used, const char **argv) | |||
| 510 | } | 510 | } |
| 511 | if (child_pid != -1) | 511 | if (child_pid != -1) |
| 512 | kill(child_pid, SIGTERM); | 512 | kill(child_pid, SIGTERM); |
| 513 | die("Not all events could be opened.\n"); | 513 | |
| 514 | pr_err("Not all events could be opened.\n"); | ||
| 514 | return -1; | 515 | return -1; |
| 515 | } | 516 | } |
| 516 | counter->supported = true; | 517 | counter->supported = true; |
| @@ -1189,7 +1190,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __used) | |||
| 1189 | output = fopen(output_name, mode); | 1190 | output = fopen(output_name, mode); |
| 1190 | if (!output) { | 1191 | if (!output) { |
| 1191 | perror("failed to create output file"); | 1192 | perror("failed to create output file"); |
| 1192 | exit(-1); | 1193 | return -1; |
| 1193 | } | 1194 | } |
| 1194 | clock_gettime(CLOCK_REALTIME, &tm); | 1195 | clock_gettime(CLOCK_REALTIME, &tm); |
| 1195 | fprintf(output, "# started on %s\n", ctime(&tm.tv_sec)); | 1196 | fprintf(output, "# started on %s\n", ctime(&tm.tv_sec)); |
