Skip to content

Commit d0768b2

Browse files
nikiccuviper
authored andcommittedJan 8, 2020
Fix sanitizer build without O_CLOEXEC
Define it to 0 if it doesn't exist.
1 parent 5895ca3 commit d0768b2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎compiler-rt/lib/sanitizer_common/sanitizer_posix.cc

+3
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,9 @@ bool ShouldMockFailureToOpen(const char *path) {
338338
}
339339

340340
#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_GO
341+
# ifndef O_CLOEXEC
342+
# define O_CLOEXEC 0
343+
# endif
341344
int GetNamedMappingFd(const char *name, uptr size, int *flags) {
342345
if (!common_flags()->decorate_proc_maps || !name)
343346
return -1;

‎compiler-rt/lib/xray/xray_x86_64.cc

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ retryingReadSome(int Fd, char *Begin, char *End) XRAY_NEVER_INSTRUMENT {
4949
return std::make_pair(TotalBytesRead, true);
5050
}
5151

52+
#ifndef O_CLOEXEC
53+
# define O_CLOEXEC 0
54+
#endif
5255
static bool readValueFromFile(const char *Filename,
5356
long long *Value) XRAY_NEVER_INSTRUMENT {
5457
int Fd = open(Filename, O_RDONLY | O_CLOEXEC);

0 commit comments

Comments
 (0)