diff options
author | jhb <jhb@FreeBSD.org> | 2015-05-31 19:43:35 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2015-05-31 19:43:35 +0000 |
commit | d0beba796228c1a13189b6ca07e73613b50f1d32 (patch) | |
tree | 9e37dbcafbd1018e9dc93ced7a763fe27933a6ce /tests/sys | |
parent | 3d67e5982eb517e590eaecef0233d7e27f32c35f (diff) | |
download | FreeBSD-src-d0beba796228c1a13189b6ca07e73613b50f1d32.zip FreeBSD-src-d0beba796228c1a13189b6ca07e73613b50f1d32.tar.gz |
Consistently only use one end of the pipe in the parent and debugger
processes and do not rely on EOF due to a close() in the debugger.
PR: 200489
Differential Revision: https://reviews.freebsd.org/D2674
Reviewed by: kib, ngie, rodrigc
Diffstat (limited to 'tests/sys')
-rw-r--r-- | tests/sys/kern/ptrace_test.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 321dc82..b8d4fa2 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -304,7 +304,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) ATF_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); /* Wait for parent's failed wait. */ - ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0); + ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == sizeof(c)); wpid = waitpid(child, &status, 0); ATF_REQUIRE(wpid == child); @@ -313,6 +313,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) exit(0); } + close(dpipe[1]); /* Parent process. */ @@ -365,10 +366,11 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) ATF_REQUIRE(wpid == 0); /* Signal the debugger to wait for the child. */ - close(dpipe[0]); + ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c)); /* Wait for the debugger. */ - ATF_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0); + ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0); + close(dpipe[0]); /* The child process should now be ready. */ wpid = waitpid(child, &status, WNOHANG); |