From: Peng H. <pe...@cn...> - 2011-03-10 09:11:21
|
waitpid() should be called after kill() in function kill_nested_containers(), otherwise the case will suspend. exit(status) should be replaced with exit(WEXITSTATUS(status)). Signed-off-by: Peng Haitao <pe...@cn...> --- testcases/kernel/containers/pidns/pidns05.c | 16 +++++++--------- 1 files changed, 7 insertions(+), 9 deletions(-) diff --git a/testcases/kernel/containers/pidns/pidns05.c b/testcases/kernel/containers/pidns/pidns05.c index 8a08dce..9ffc946 100644 --- a/testcases/kernel/containers/pidns/pidns05.c +++ b/testcases/kernel/containers/pidns/pidns05.c @@ -186,13 +186,8 @@ void kill_nested_containers() /* Loops through the containers created to exit from sleep() */ for (i = 0; i < MAX_DEPTH; i++) { - if (waitpid(pids[i], &status, 0) == -1) - tst_resm(TFAIL|TERRNO, "waitpid(%d, ...) failed", - pids[i]); - else { - kill(pids[i], SIGKILL); - waitpid(pids[i], &status, 0); - } + kill(pids[i], SIGKILL); + waitpid(pids[i], &status, 0); } } @@ -222,7 +217,10 @@ int main(int argc, char *argv[]) if (waitpid(pid, &status, 0) == -1) { perror("wait failed"); } - exit(status); + if (WIFEXITED(status)) + exit(WEXITSTATUS(status)); + else + exit(status); } /* To make all the containers share the same PGID as its parent */ @@ -255,4 +253,4 @@ int main(int argc, char *argv[]) cleanup(); tst_exit(); -} \ No newline at end of file +} -- 1.7.1 -- Best Regards, Peng Haitao |