summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_solaris.cc
diff options
context:
space:
mode:
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-12-20 20:36:33 +0000
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>2018-12-20 20:36:33 +0000
commit6e82742873f2e12f77c427ef3c9387e5016cdb9b (patch)
treea9de838e18ea962abed3ecf63ab4a40451a74306 /lib/sanitizer_common/sanitizer_solaris.cc
parentff3c1b3c295c7e1181b4cd87f11c1b95613d2063 (diff)
downloadcompiler-rt-6e82742873f2e12f77c427ef3c9387e5016cdb9b.tar.gz
[sanitizer] Support running without fd 0,1,2.
Summary: Support running with no open file descriptors (as may happen to "init" process on linux). * Remove a check that writing to stderr succeeds. * When opening a file (ex. for log_path option), dup the new fd out of [0, 2] range to avoid confusing the program. (2nd attempt, this time without the sanitizer_rtems change) Reviewers: pcc, vitalybuka Subscribers: kubamracek, llvm-commits Differential Revision: https://reviews.llvm.org/D55801 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@349817 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_solaris.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_solaris.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sanitizer_common/sanitizer_solaris.cc b/lib/sanitizer_common/sanitizer_solaris.cc
index 9d0c3d93d..cc0201c7a 100644
--- a/lib/sanitizer_common/sanitizer_solaris.cc
+++ b/lib/sanitizer_common/sanitizer_solaris.cc
@@ -88,8 +88,8 @@ uptr internal_open(const char *filename, int flags, u32 mode) {
}
uptr OpenFile(const char *filename, bool write) {
- return internal_open(filename,
- write ? O_WRONLY | O_CREAT : O_RDONLY, 0660);
+ return ReserveStandardFds(
+ internal_open(filename, write ? O_WRONLY | O_CREAT : O_RDONLY, 0660));
}
DECLARE__REAL_AND_INTERNAL(uptr, read, fd_t fd, void *buf, uptr count) {