From d8d3d8d81f1ba459087f76f89bcbb88f7a80b873 Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Fri, 9 Jun 2017 09:25:15 +0300 Subject: [PATCH] zdtm: pidns03: Wait till child dead Wait child before daemonization to do not allow zdtm.py to see child fds and maps before it becomes zombie. Signed-off-by: Andrei Vagin --- test/zdtm/static/pidns03.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/zdtm/static/pidns03.c b/test/zdtm/static/pidns03.c index 1cca6e72a..9d7d7635e 100644 --- a/test/zdtm/static/pidns03.c +++ b/test/zdtm/static/pidns03.c @@ -113,6 +113,13 @@ static int child_fn(void) goto err; } else if (!pid) exit(0); + + ret = waitid(P_PID, pid, NULL, WEXITED|WNOWAIT); + if (ret) { + fail("Can't wait"); + goto err; + } + futex_set_and_wake(futex, CHILD_PREPARED); futex_wait_while_lt(futex, POST_RESTORE_CHECK);