Skip to contentSkip to conversation

perf_counter tools: Guard against record damaging existing files

tip:perfcounters/core tip-bot for Mike Galbraith 1 participant 1 message Jun 1, 2009 Documentation

lore
Share & tools
lore
#0 lore raw
Commit-ID:  229c4eedcedcdadf70411120ba34bc37554a74bd
Gitweb:     http://git.kernel.org/tip/229c4eedcedcdadf70411120ba34bc37554a74bd
Author:     Mike Galbraith <[email protected]>
AuthorDate: Thu, 28 May 2009 16:28:53 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Mon, 1 Jun 2009 20:10:24 +0200

perf_counter tools: Guard against record damaging existing files

LKML-Reference: <new-submission>

---
 Documentation/perf_counter/builtin-record.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Documentation/perf_counter/builtin-record.c +1 -1
index 23d1224..96bfb7c 100644
@@ -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);