[compiler-rt] r201240 - [asan] Handle OpenFile errors in CovDump.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Wed Feb 12 07:29:23 PST 2014
Author: eugenis
Date: Wed Feb 12 09:29:22 2014
New Revision: 201240
URL: http://llvm.org/viewvc/llvm-project?rev=201240&view=rev
Log:
[asan] Handle OpenFile errors in CovDump.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage.cc?rev=201240&r1=201239&r2=201240&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage.cc Wed Feb 12 09:29:22 2014
@@ -95,9 +95,13 @@ void CovDump() {
module_name, internal_getpid());
InternalFree(module_name);
uptr fd = OpenFile(path.data(), true);
- internal_write(fd, offsets.data(), offsets.size() * sizeof(u32));
- internal_close(fd);
- VReport(1, " CovDump: %s: %zd PCs written\n", path.data(), vb - old_vb);
+ if (internal_iserror(fd)) {
+ Report(" CovDump: failed to open %s for writing\n", path.data());
+ } else {
+ internal_write(fd, offsets.data(), offsets.size() * sizeof(u32));
+ internal_close(fd);
+ VReport(1, " CovDump: %s: %zd PCs written\n", path.data(), vb - old_vb);
+ }
}
}
#endif // !SANITIZER_WINDOWS
More information about the llvm-commits
mailing list