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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 90c98082af10..0345aad8eba5 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -525,10 +525,14 @@ static int __cmd_record(int argc, const char **argv)
525 signal(SIGCHLD, sig_handler); 525 signal(SIGCHLD, sig_handler);
526 signal(SIGINT, sig_handler); 526 signal(SIGINT, sig_handler);
527 527
528 if (!stat(output_name, &st) && !force && !append_file) { 528 if (!stat(output_name, &st) && st.st_size) {
529 fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n", 529 if (!force && !append_file) {
530 output_name); 530 fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n",
531 exit(-1); 531 output_name);
532 exit(-1);
533 }
534 } else {
535 append_file = 0;
532 } 536 }
533 537
534 flags = O_CREAT|O_RDWR; 538 flags = O_CREAT|O_RDWR;