[CRIU] [PATCH] zdtm: pidns02: Wait till child dead

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jun 8 19:52:28 MSK 2017


Wait child before daemonization to do not allow
zdtm.py to see child fds and maps before it
becomes zombie.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 test/zdtm/static/pidns02.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/test/zdtm/static/pidns02.c b/test/zdtm/static/pidns02.c
index 60e4dbdd0..80262f090 100644
--- a/test/zdtm/static/pidns02.c
+++ b/test/zdtm/static/pidns02.c
@@ -149,8 +149,15 @@ int main(int argc, char **argv)
 		goto out;
 	}
 
-	if (kill(pid[1], SIGKILL))
-		pr_perror("Can't kill");
+	if (kill(pid[1], SIGKILL)) {
+		fail("Can't kill");
+		goto out;
+	}
+	ret = waitid(P_PID, pid[1], NULL, WEXITED|WNOWAIT);
+	if (ret) {
+		fail("Can't wait");
+		goto out;
+	}
 
 	test_daemon();
 	test_waitsig();



More information about the CRIU mailing list