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
This commit is contained in:
Bill Wendling 2012-05-25 21:55:06 +00:00
parent d72d67da07
commit e00c8fdcc1

View File

@ -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;