waitpid/waitpid02: check if fork failed
PATCH 1/1 waitpid/waitpid02: check if fork failed
Break the test if fork failed. Or this test case will kill a lot of processes on the system.
--- testcases/kernel/syscalls/waitpid/waitpid02.c | 4 ++++ 1 file changed, 4 insertions(+)
testcases/kernel/syscalls/waitpid/waitpid02.c +4 -0
@@ -96,6 +96,10 @@ int main(int argc, char **argv)do_child ();#endif }else { +if (pid <0 ) { +tst_brkm (TBROK |TERRNO , cleanup,"fork failed" ); + } +kill (pid, sig); errno =0 ; while (((npid = waitpid(pid, &status, 0)) != -1) ||
Signature · 1 line
1.9.3
PATCH 1/1 waitpid/waitpid02: check if fork failed
Hi!
testcases/kernel/syscalls/waitpid/waitpid02.c int main(int argc, char **argv) · line 101
Quoted 4 lines
testcases/kernel/syscalls/waitpid/waitpid02.c +3
-0}else { +if (pid <0 ) { +tst_brkm (TBROK |TERRNO , cleanup,"fork failed" ); + }
The check should be done right after the fork() and not in the else branch. Also there shoudln't be the curly braces around the tst_brkm() since it's just a signle line.
Otherwise it's fine.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 waitpid/waitpid02: check if fork failed
Quoted 10 lines · Cyril Hrubis
Hi!
Review
Quoted 4 lines
(quoted diff) +3
-0} else { + if (pid < 0) { + tst_brkm(TBROK|TERRNO, cleanup, "fork failed"); + }The check should be done right after the
fork()and not in the else branch. Also there shoudln't be the curly braces around thetst_brkm()since it's just a signle line.
Quoted 2 lines
Otherwise it's fine.
Thanks. This is the new patch.
From 9785b11acc164725a5e93766ec08d199831fd7e5 Mon Sep 17 00:00:00 2001
From: Han Pingtian <[email protected]>
Date: Mon, 11 Apr 2016 23:46:34 +0800
Subject: [PATCH] waitpid/waitpid02: check if fork failed
Break the test if fork failed. Or this test case will kill a lot of processes on the system.
--- testcases/kernel/syscalls/waitpid/waitpid02.c | 3 +++ 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/waitpid/waitpid02.c +3 -0
@@ -88,6 +88,9 @@ int main(int argc, char **argv) pid =FORK_OR_VFORK (); +if (pid <0 ) +tst_brkm (TBROK |TERRNO , cleanup,"fork failed" ); +if (pid ==0 ) {#ifdef UCLINUX self_exec (argv[0 ],"" );
Signature · 1 line
1.9.3
PATCH 1/1 waitpid/waitpid02: check if fork failed
Hi!
Pushed, thanks.
Signature · 2 lines
Cyril Hrubis [email protected]