[llvm-commits] [llvm] r157501 - /llvm/trunk/runtime/libprofile/GCDAProfiling.c

Bill Wendling isanbard at gmail.com
Fri May 25 14:55:06 PDT 2012


Author: void
Date: Fri May 25 16:55:06 2012
New Revision: 157501

URL: http://llvm.org/viewvc/llvm-project?rev=157501&view=rev
Log:
Open in read/write mode, creating the file if it doesn't exist.

Modified:
    llvm/trunk/runtime/libprofile/GCDAProfiling.c

Modified: llvm/trunk/runtime/libprofile/GCDAProfiling.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtime/libprofile/GCDAProfiling.c?rev=157501&r1=157500&r2=157501&view=diff
==============================================================================
--- llvm/trunk/runtime/libprofile/GCDAProfiling.c (original)
+++ llvm/trunk/runtime/libprofile/GCDAProfiling.c Fri May 25 16:55:06 2012
@@ -110,14 +110,14 @@
   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;





More information about the llvm-commits mailing list