summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
diff options
context:
space:
mode:
authorMichal Gorny <mgorny@gentoo.org>2019-01-02 17:37:09 +0000
committerMichal Gorny <mgorny@gentoo.org>2019-01-02 17:37:09 +0000
commit71a75307aed22d92641c6a9b5912f40a88b014ce (patch)
tree387c71d54af40a2a7525eaac3910133036558bc4 /compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
parent7cab4722d3d1ba985ecba34745a346ede0289f8f (diff)
downloadbcm5719-llvm-71a75307aed22d92641c6a9b5912f40a88b014ce.tar.gz
bcm5719-llvm-71a75307aed22d92641c6a9b5912f40a88b014ce.zip
[sanitizer_common] Implement popen, popenve, pclose interceptors
Implement the interceptors for popen(), pclose() and popenve() functions. The first two are POSIX, the third one is specific to NetBSD. popen() spawns a process and creates a FILE object piping data from/to that process. pclose() closes the pipe and waits for the process to terminate appropriately. For the purpose of popen(), the COMMON_INTERCEPTOR_FILE_OPEN macro is modified to allow null path parameter. Differential Revision: https://reviews.llvm.org/D56157 llvm-svn: 350232
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_interceptors.cc')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_interceptors.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
index cc6dab8f1ce..eaf84558824 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc
@@ -2254,7 +2254,8 @@ static void HandleRecvmsg(ThreadState *thr, uptr pc,
(void) ctx;
#define COMMON_INTERCEPTOR_FILE_OPEN(ctx, file, path) \
- Acquire(thr, pc, File2addr(path)); \
+ if (path) \
+ Acquire(thr, pc, File2addr(path)); \
if (file) { \
int fd = fileno_unlocked(file); \
if (fd >= 0) FdFileCreate(thr, pc, fd); \
OpenPOWER on IntegriCloud