summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-05-25 21:55:06 +0000
committerBill Wendling <isanbard@gmail.com>2012-05-25 21:55:06 +0000
commite00c8fdcc150516ea55304000f28d468c75334aa (patch)
treed2320a06def18e61eac1a5873e12ccbbf97b6699 /runtime
parentd72d67da07299d7773bfd97f75a469accfdc58de (diff)
downloadllvm-e00c8fdcc150516ea55304000f28d468c75334aa.tar.gz
llvm-e00c8fdcc150516ea55304000f28d468c75334aa.tar.bz2
llvm-e00c8fdcc150516ea55304000f28d468c75334aa.tar.xz
Open in read/write mode, creating the file if it doesn't exist.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'runtime')
-rw-r--r--runtime/libprofile/GCDAProfiling.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/libprofile/GCDAProfiling.c b/runtime/libprofile/GCDAProfiling.c
index 2c373484bb..32d19ad774 100644
--- a/runtime/libprofile/GCDAProfiling.c
+++ b/runtime/libprofile/GCDAProfiling.c
@@ -110,14 +110,14 @@ void llvm_gcda_start_file(const char *orig_filename) {
char *filename;
filename = mangle_filename(orig_filename);
recursive_mkdir(filename);
- output_file = fopen(filename, "wb");
+ output_file = fopen(filename, "w+b");
if (!output_file) {
const char *cptr = strrchr(orig_filename, '/');
- output_file = fopen(cptr ? cptr + 1 : orig_filename, "wb");
+ output_file = fopen(cptr ? cptr + 1 : orig_filename, "w+b");
if (!output_file) {
- fprintf(stderr, "LLVM profiling runtime: while opening '%s': ",
+ fprintf(stderr, "LLVM profiling runtime: cannot open '%s': ",
cptr ? cptr + 1 : orig_filename);
perror("");
return;