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.


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157572 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/profile/GCDAProfiling.c b/lib/profile/GCDAProfiling.c
index 1126787..4d0c41b 100644
--- a/lib/profile/GCDAProfiling.c
+++ b/lib/profile/GCDAProfiling.c
@@ -113,21 +113,10 @@
   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;
     }
   }