Skip to contentSkip to conversation

waitid/waitid01: break test if fork() failed

PATCH New Han Pingtian 2 participants 2 messages Apr 14, 2016 – Apr 18, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 waitid/waitid01: break test if fork() failed

Or a lot of processes will be killed when -1 passed as pid to kill().

---
 testcases/kernel/syscalls/waitid/waitid01.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
testcases/kernel/syscalls/waitid/waitid01.c +12 -0
index c19f0da..1729aa3 100644
@@ -130,6 +130,10 @@ int main(int ac, char **av)
 		for (testno = 0; testno < TST_TOTAL; ++testno) {
 
 			TEST(fork());
+			if (TEST_RETURN < 0)
+				tst_brkm(TBROK | TTERRNO, NULL,
+					"fork() failed");
+
 			if (TEST_RETURN == 0) {
 				exit(123);
 			} else {
@@ -143,6 +147,10 @@ int main(int ac, char **av)
 			}
 
 			TEST(fork());
+			if (TEST_RETURN < 0)
+				tst_brkm(TBROK | TTERRNO, NULL,
+					"fork() failed");
+
 			if (TEST_RETURN == 0) {
 				int a, b = 0;
 				a = 1 / b;
@@ -157,6 +165,10 @@ int main(int ac, char **av)
 			}
 
 			TEST(pid = fork());
+			if (TEST_RETURN < 0)
+				tst_brkm(TBROK | TTERRNO, NULL,
+					"fork() failed");
+
 			if (TEST_RETURN == 0) {
 				TEST(sleep(10));
 				tst_exit();
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/1 waitid/waitid01: break test if fork() failed

Hi!

Quoted 1 line

Or a lot of processes will be killed when -1 passed as pid to kill().

Pushed, thanks.

Signature · 2 lines
Cyril Hrubis
[email protected]