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 committed Feb 4, 2020
1 parent be4af5f commit a08a0b0
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.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,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.cpp
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 a08a0b0

Please sign in to comment.