Skip to content

Commit

Permalink
Fix sanitizer build without O_CLOEXEC
Browse files Browse the repository at this point in the history
Define it to 0 if it doesn't exist.
  • Loading branch information
nikic authored and alexcrichton committed Jul 12, 2019
1 parent fca8a9f commit c2f0d9e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler-rt/lib/sanitizer_common/sanitizer_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ bool ShouldMockFailureToOpen(const char *path) {
}

#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_GO
# ifndef O_CLOEXEC
# define O_CLOEXEC 0
# endif
int GetNamedMappingFd(const char *name, uptr size, int *flags) {
if (!common_flags()->decorate_proc_maps || !name)
return -1;
Expand Down
3 changes: 3 additions & 0 deletions compiler-rt/lib/xray/xray_x86_64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ retryingReadSome(int Fd, char *Begin, char *End) XRAY_NEVER_INSTRUMENT {
return std::make_pair(TotalBytesRead, true);
}

#ifndef O_CLOEXEC
# define O_CLOEXEC 0
#endif
static bool readValueFromFile(const char *Filename,
long long *Value) XRAY_NEVER_INSTRUMENT {
int Fd = open(Filename, O_RDONLY | O_CLOEXEC);
Expand Down

0 comments on commit c2f0d9e

Please sign in to comment.