forked from OSchip/llvm-project
asna/tsan/msan: fix wait() interceptors to allow NULL arguments
llvm-svn: 180703
This commit is contained in:
parent
07cea1911a
commit
639ba01fc3
|
@ -644,7 +644,7 @@ INTERCEPTOR(int, wait, int *status) {
|
|||
void *ctx;
|
||||
COMMON_INTERCEPTOR_ENTER(ctx, wait, status);
|
||||
int res = REAL(wait)(status);
|
||||
if (res != -1)
|
||||
if (res != -1 && status)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
return res;
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ INTERCEPTOR(int, waitid, int idtype, int id, void *infop, int options) {
|
|||
void *ctx;
|
||||
COMMON_INTERCEPTOR_ENTER(ctx, waitid, idtype, id, infop, options);
|
||||
int res = REAL(waitid)(idtype, id, infop, options);
|
||||
if (res != -1)
|
||||
if (res != -1 && infop)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, infop, siginfo_t_sz);
|
||||
return res;
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ INTERCEPTOR(int, waitpid, int pid, int *status, int options) {
|
|||
void *ctx;
|
||||
COMMON_INTERCEPTOR_ENTER(ctx, waitpid, pid, status, options);
|
||||
int res = REAL(waitpid)(pid, status, options);
|
||||
if (res != -1)
|
||||
if (res != -1 && status)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
return res;
|
||||
}
|
||||
|
@ -669,7 +669,8 @@ INTERCEPTOR(int, wait3, int *status, int options, void *rusage) {
|
|||
COMMON_INTERCEPTOR_ENTER(ctx, wait3, status, options, rusage);
|
||||
int res = REAL(wait3)(status, options, rusage);
|
||||
if (res != -1) {
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
if (status)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
if (rusage)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, rusage, struct_rusage_sz);
|
||||
}
|
||||
|
@ -680,7 +681,8 @@ INTERCEPTOR(int, wait4, int pid, int *status, int options, void *rusage) {
|
|||
COMMON_INTERCEPTOR_ENTER(ctx, wait4, pid, status, options, rusage);
|
||||
int res = REAL(wait4)(pid, status, options, rusage);
|
||||
if (res != -1) {
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
if (status)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, status, sizeof(*status));
|
||||
if (rusage)
|
||||
COMMON_INTERCEPTOR_WRITE_RANGE(ctx, rusage, struct_rusage_sz);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue