浏览代码

perf_counter tools: Guard against record damaging existing files

Signed-off-by: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Mike Galbraith 16 年之前
父节点
当前提交
229c4eedce
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Documentation/perf_counter/builtin-record.c

+ 1 - 1
Documentation/perf_counter/builtin-record.c

@@ -340,7 +340,7 @@ static int __cmd_record(int argc, const char **argv)
 	assert(nr_cpus <= MAX_NR_CPUS);
 	assert(nr_cpus >= 0);
 
-	output = open(output_name, O_CREAT|O_RDWR, S_IRWXU);
+	output = open(output_name, O_CREAT|O_EXCL|O_RDWR, S_IRWXU);
 	if (output < 0) {
 		perror("failed to create output file");
 		exit(-1);