tests: only wait for the pid we spawned

In the next patch, we'll introduce an option to allow for leaving zombie
processes in the pid ns for the test so that we can test the behavior of
zombies. Let's not reap everything after restore, since we'll reap the
restored zombies as well.

v2: restore the old behavior when in reap mode

CC: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Tycho Andersen 2016-07-13 15:10:53 +00:00 committed by Pavel Emelyanov
parent b3c42b28a9
commit d5bee200a1

View file

@ -343,8 +343,13 @@ int ns_init(int argc, char **argv)
kill(pid, SIGTERM);
ret = 0;
while (ret != -1)
ret = wait(NULL);
if (reap) {
while (ret != -1)
ret = wait(NULL);
} else {
waitpid(pid, NULL, 0);
}
exit(1);
}