Simplify the logic that tries to open the GCDA file at all costs. Basically, if

we can't open the file even after creating all of the directories to it, then
just give up.

llvm-svn: 157572
This commit is contained in:
Bill Wendling 2012-05-28 09:46:43 +00:00
parent bba2a7d46d
commit 65adec933d
1 changed files with 2 additions and 13 deletions

View File

@ -113,21 +113,10 @@ void llvm_gcda_start_file(const char *orig_filename) {
output_file = fopen(filename, "w+b");
if (!output_file) {
int len = strlen(orig_filename) - 1;
recursive_mkdir(filename);
for (; len >= 0 && orig_filename[len] != '/'; --len)
/* empty */;
if (len < 0)
len = 0;
else if (orig_filename[len] == '/')
++len;
output_file = fopen(&orig_filename[len], "w+b");
output_file = fopen(filename, "w+b");
if (!output_file) {
fprintf(stderr, "profiling:%s: cannot open\n", &orig_filename[len]);
fprintf(stderr, "profiling:%s: cannot open\n", filename);
return;
}
}