[Sanitizer coverage] Print out the error number if OpenFile fails
authorTimur Iskhodzhanov <timurrrr@google.com>
Thu, 23 Apr 2015 13:18:50 +0000 (13:18 +0000)
committerTimur Iskhodzhanov <timurrrr@google.com>
Thu, 23 Apr 2015 13:18:50 +0000 (13:18 +0000)
llvm-svn: 235593

compiler-rt/lib/sanitizer_common/sanitizer_coverage_libcdep.cc

index 2c7c7e0..171c6ca 100644 (file)
@@ -571,9 +571,11 @@ static fd_t CovOpenFile(InternalScopedString *path, bool packed,
     else
       path->append("%s/%s.%s.packed", coverage_dir, name, extension);
   }
-  fd_t fd = OpenFile(path->data(), WrOnly);
+  error_t err;
+  fd_t fd = OpenFile(path->data(), WrOnly, &err);
   if (fd == kInvalidFd)
-    Report("SanitizerCoverage: failed to open %s for writing\n", path->data());
+    Report("SanitizerCoverage: failed to open %s for writing (reason: %d)\n",
+           path->data(), err);
   return fd;
 }