[CRIU] [PATCH] zdtm/session04: do cleanup on success and wait children in it

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Tue Aug 8 12:25:26 MSK 2017


https://github.com/xemul/criu/issues/372
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 test/zdtm/static/session04.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/test/zdtm/static/session04.c b/test/zdtm/static/session04.c
index 155480ff3..b0ee4d95d 100644
--- a/test/zdtm/static/session04.c
+++ b/test/zdtm/static/session04.c
@@ -32,9 +32,21 @@ int current = 0;
 
 static void cleanup()
 {
+	int ret;
+
 	kill(processes[0].pid, SIGKILL);
 	/* It's enought to kill pidns init for others to die */
 	kill(processes[1].pid, SIGKILL);
+
+	while (1) {
+		ret = wait(NULL);
+		if (ret == -1) {
+			if (errno == ECHILD)
+				break;
+			pr_perror("wait");
+			exit(1);
+		}
+	}
 }
 
 enum commands
@@ -423,8 +435,8 @@ int main(int argc, char ** argv)
 	if (fail_cnt)
 		goto err;
 
+	cleanup();
 	pass();
-
 	return 0;
 err:
 	cleanup();
-- 
2.13.3



More information about the CRIU mailing list