diff options
| author | Alexander Potapenko <glider@google.com> | 2015-03-23 10:10:46 +0000 |
|---|---|---|
| committer | Alexander Potapenko <glider@google.com> | 2015-03-23 10:10:46 +0000 |
| commit | 141e420a819ce626e4e2401e2d9f5306a9e2c9e6 (patch) | |
| tree | d9c81b9720d96b487316fb32bc16fd9f152d4348 /compiler-rt/lib/sanitizer_common/sanitizer_common.cc | |
| parent | 8f7c5a7f18d0482fdc99c1c02679830fac89bcc6 (diff) | |
| download | bcm5719-llvm-141e420a819ce626e4e2401e2d9f5306a9e2c9e6.tar.gz bcm5719-llvm-141e420a819ce626e4e2401e2d9f5306a9e2c9e6.zip | |
[ASan] Distinguish between read, write and read-write file access modes in OpenFile.
This is to fix mapping coverage files into memory on OSX.
llvm-svn: 232936
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_common.cc')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc index a477934ce83..956fc993521 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc @@ -58,7 +58,7 @@ void ReportFile::ReopenIfNecessary() { } internal_snprintf(full_path, kMaxPathLength, "%s.%zu", path_prefix, pid); - uptr openrv = OpenFile(full_path, true); + uptr openrv = OpenFile(full_path, WrOnly); if (internal_iserror(openrv)) { const char *ErrorMsgPrefix = "ERROR: Can't open file: "; internal_write(kStderrFd, ErrorMsgPrefix, internal_strlen(ErrorMsgPrefix)); @@ -144,7 +144,7 @@ uptr ReadFileToBuffer(const char *file_name, char **buff, uptr *buff_size, *buff_size = 0; // The files we usually open are not seekable, so try different buffer sizes. for (uptr size = kMinFileLen; size <= max_len; size *= 2) { - uptr openrv = OpenFile(file_name, /*write*/ false); + uptr openrv = OpenFile(file_name, RdOnly); if (internal_iserror(openrv, errno_p)) return 0; fd_t fd = openrv; UnmapOrDie(*buff, *buff_size); |

