| Index: sandbox/linux/services/syscall_wrappers_unittest.cc
|
| diff --git a/sandbox/linux/services/syscall_wrappers_unittest.cc b/sandbox/linux/services/syscall_wrappers_unittest.cc
|
| index 861dd5feb1c02aa7ece96186694f6b7b675a19f1..79ed63d68910ab0e64f134165a6bda9878856424 100644
|
| --- a/sandbox/linux/services/syscall_wrappers_unittest.cc
|
| +++ b/sandbox/linux/services/syscall_wrappers_unittest.cc
|
| @@ -39,14 +39,18 @@ TEST(SyscallWrappers, CloneParentSettid) {
|
| }
|
|
|
| TEST(SyscallWrappers, CloneChildSettid) {
|
| + // Warm up the libc pid cache, if there is one.
|
| + ASSERT_EQ(sys_getpid(), getpid());
|
| +
|
| pid_t ctid = 0;
|
| pid_t pid =
|
| sys_clone(CLONE_CHILD_SETTID | SIGCHLD, nullptr, nullptr, &ctid, nullptr);
|
|
|
| const int kSuccessExit = 0;
|
| if (0 == pid) {
|
| - // In child.
|
| - if (sys_getpid() == ctid)
|
| + // In child. Check both the raw getpid syscall and the libc getpid wrapper
|
| + // (which may rely on a pid cache).
|
| + if (sys_getpid() == ctid && getpid() == ctid)
|
| _exit(kSuccessExit);
|
| _exit(1);
|
| }
|
|
|