diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2013-10-15 12:25:29 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2013-10-15 12:25:29 +0000 |
| commit | 7ac0b2b0e1f683e11b074d61c8a915560ab74588 (patch) | |
| tree | bec306b1273cf11b7270f3d63f5f607a811b38bc /compiler-rt/lib/sanitizer_common/sanitizer_common.cc | |
| parent | 7a2bbc30a2a397134ac22262e5bcaf0afc8ce98d (diff) | |
| download | bcm5719-llvm-7ac0b2b0e1f683e11b074d61c8a915560ab74588.tar.gz bcm5719-llvm-7ac0b2b0e1f683e11b074d61c8a915560ab74588.zip | |
tsan: use sanitizer::CommonFlags in tsan
llvm-svn: 192692
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/sanitizer_common.cc')
| -rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_common.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc index 4cf694aacfc..76f90712c76 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_common.cc +++ b/compiler-rt/lib/sanitizer_common/sanitizer_common.cc @@ -202,7 +202,8 @@ using namespace __sanitizer; // NOLINT extern "C" { void __sanitizer_set_report_path(const char *path) { - if (!path) return; + if (!path) + return; uptr len = internal_strlen(path); if (len > sizeof(report_path_prefix) - 100) { Report("ERROR: Path is too long: %c%c%c%c%c%c%c%c...\n", @@ -210,18 +211,21 @@ void __sanitizer_set_report_path(const char *path) { path[4], path[5], path[6], path[7]); Die(); } - internal_strncpy(report_path_prefix, path, sizeof(report_path_prefix)); - report_path_prefix[len] = '\0'; - report_fd = kInvalidFd; - log_to_file = true; -} - -void __sanitizer_set_report_fd(int fd) { if (report_fd != kStdoutFd && report_fd != kStderrFd && report_fd != kInvalidFd) internal_close(report_fd); - report_fd = fd; + report_fd = kInvalidFd; + log_to_file = false; + if (internal_strcmp(path, "stdout") == 0) { + report_fd = kStdoutFd; + } else if (internal_strcmp(path, "stderr") == 0) { + report_fd = kStderrFd; + } else { + internal_strncpy(report_path_prefix, path, sizeof(report_path_prefix)); + report_path_prefix[len] = '\0'; + log_to_file = true; + } } void NOINLINE __sanitizer_sandbox_on_notify(void *reserved) { |

