aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 6da09928130f..0345aad8eba5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -412,6 +412,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
412 if (call_graph) 412 if (call_graph)
413 attr->sample_type |= PERF_SAMPLE_CALLCHAIN; 413 attr->sample_type |= PERF_SAMPLE_CALLCHAIN;
414 414
415
415 attr->mmap = track; 416 attr->mmap = track;
416 attr->comm = track; 417 attr->comm = track;
417 attr->inherit = (cpu < 0) && inherit; 418 attr->inherit = (cpu < 0) && inherit;
@@ -524,10 +525,14 @@ static int __cmd_record(int argc, const char **argv)
524 signal(SIGCHLD, sig_handler); 525 signal(SIGCHLD, sig_handler);
525 signal(SIGINT, sig_handler); 526 signal(SIGINT, sig_handler);
526 527
527 if (!stat(output_name, &st) && !force && !append_file) { 528 if (!stat(output_name, &st) && st.st_size) {
528 fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n", 529 if (!force && !append_file) {
529 output_name); 530 fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n",
530 exit(-1); 531 output_name);
532 exit(-1);
533 }
534 } else {
535 append_file = 0;
531 } 536 }
532 537
533 flags = O_CREAT|O_RDWR; 538 flags = O_CREAT|O_RDWR;