Garrett Cooper said the following on 2011-3-10 17:24: >> exit(status) should be replaced with exit(WEXITSTATUS(status)). > > No. Read wait(2) about WIFEXITED and WEXITSTATUS. >
The following patch modifies the description of WEXITSTATUS(status). So, what about this one? ----------------------------------------------------------------------------- waitpid() should be called after kill() in function kill_nested_containers(), otherwise the case will suspend. The status of waitpid() should be extracted by WIFEXITED(status) and WEXITSTATUS(status). Signed-off-by: Peng Haitao <[email protected]> --- 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 ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
