aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index a66a58d52818..66979a5553b8 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -421,10 +421,19 @@ static int __cmd_record(int argc, const char **argv)
421 signal(SIGINT, sig_handler); 421 signal(SIGINT, sig_handler);
422 422
423 if (!stat(output_name, &st) && st.st_size) { 423 if (!stat(output_name, &st) && st.st_size) {
424 if (!force && !append_file) { 424 if (!force) {
425 fprintf(stderr, "Error, output file %s exists, use -A to append or -f to overwrite.\n", 425 if (!append_file) {
426 output_name); 426 pr_err("Error, output file %s exists, use -A "
427 exit(-1); 427 "to append or -f to overwrite.\n",
428 output_name);
429 exit(-1);
430 }
431 } else {
432 char oldname[PATH_MAX];
433 snprintf(oldname, sizeof(oldname), "%s.old",
434 output_name);
435 unlink(oldname);
436 rename(output_name, oldname);
428 } 437 }
429 } else { 438 } else {
430 append_file = 0; 439 append_file = 0;