From 7251167f52e91c133ea5b245fa43060397b02c8c Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Wed, 4 Jan 2017 08:25:31 +0000 Subject: [PATCH] Clarify lifetime of child(..) function Ensure child exits when complete as it's always run in a forked process. Add a missing break statement in :pselect_sigmask when calling child(..) for clarity and to avoid weird domino effects if the child process somehow does something it's not supposed to do with the logfiles, file descriptors, etc MFC after: 1 week Reported by: Coverity CID: 1223369, 1223370, 1300301 --- contrib/netbsd-tests/lib/libc/sys/t_select.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_select.c b/contrib/netbsd-tests/lib/libc/sys/t_select.c index 7af725a9a1f..437b67b5e9c 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_select.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_select.c @@ -135,6 +135,9 @@ child(const struct timespec *ts) "after timeout %s != %s", prmask(&nset, nbuf, sizeof(nbuf)), prmask(&oset, obuf, sizeof(obuf))); +#ifdef __FreeBSD__ + _exit(0); +#endif } ATF_TC(pselect_sigmask); @@ -154,6 +157,9 @@ ATF_TC_BODY(pselect_sigmask, tc) switch (pid = fork()) { case 0: child(NULL); +#ifdef __FreeBSD__ + break; +#endif case -1: err(1, "fork"); default: