Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 229c4eed authored by Mike Galbraith's avatar Mike Galbraith Committed by Ingo Molnar
Browse files

perf_counter tools: Guard against record damaging existing files



Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 22a4f650
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -340,7 +340,7 @@ static int __cmd_record(int argc, const char **argv)
	assert(nr_cpus <= MAX_NR_CPUS);
	assert(nr_cpus <= MAX_NR_CPUS);
	assert(nr_cpus >= 0);
	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) {
	if (output < 0) {
		perror("failed to create output file");
		perror("failed to create output file");
		exit(-1);
		exit(-1);