All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] waitpid/waitpid02: check if fork failed
@ 2016-04-12  3:03 Han Pingtian
  2016-04-12 10:05 ` Cyril Hrubis
  0 siblings, 1 reply; 4+ messages in thread
From: Han Pingtian @ 2016-04-12  3:03 UTC (permalink / raw)
  To: ltp

Break the test if fork failed. Or this test case will kill a lot of
processes on the system.

Signed-off-by: Han Pingtian <hanpt@linux.vnet.ibm.com>
---
 testcases/kernel/syscalls/waitpid/waitpid02.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/testcases/kernel/syscalls/waitpid/waitpid02.c b/testcases/kernel/syscalls/waitpid/waitpid02.c
index e5d7957..73cdb83 100644
--- a/testcases/kernel/syscalls/waitpid/waitpid02.c
+++ b/testcases/kernel/syscalls/waitpid/waitpid02.c
@@ -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) ||
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-12 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-12  3:03 [LTP] [PATCH] waitpid/waitpid02: check if fork failed Han Pingtian
2016-04-12 10:05 ` Cyril Hrubis
2016-04-12 13:13   ` Han Pingtian
2016-04-12 13:31     ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.