From: Mike Galbraith Date: Thu, 28 May 2009 14:28:53 +0000 (+0200) Subject: perf_counter tools: Guard against record damaging existing files X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=229c4eedcedcdadf70411120ba34bc37554a74bd;p=linux-beck.git perf_counter tools: Guard against record damaging existing files Signed-off-by: Mike Galbraith Cc: Peter Zijlstra LKML-Reference: Signed-off-by: Ingo Molnar --- diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c index 23d1224ce98c..96bfb7c5f1e4 100644 --- a/Documentation/perf_counter/builtin-record.c +++ b/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);