[PATCH 03/11] cr_tests: Always report an exit code that could indicate failure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Restructure the exit paths of the children to always report the exit and
check the pass/fail variables before exiting.

Signed-off-by: Matt Helsley <matthltc@xxxxxxxxxx>
Cc: containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
---
 futex/robust.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/futex/robust.c b/futex/robust.c
index 05fd4e9..f63b7d1 100644
--- a/futex/robust.c
+++ b/futex/robust.c
@@ -259,13 +259,14 @@ int kid(int i)
 {
 	if (set_robust_list(&rlist, sizeof(rlist)) < 0) {
 		log_error("set_robust_list");
-		fail++;
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 	if (check_rlist(i) != 0) {
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 
 	log("INFO", "signaling ready for checkpointing\n");
@@ -274,18 +275,20 @@ int kid(int i)
 
 	if (check_rlist(i) != 0) {
 		send_parent_status(&children_ready[1], CHILD_ERROR);
-		return -1;
+		fail++;
+		goto do_exit;
 	}
 
 	send_parent_status(&children_ready[1], CHILD_READY);
 	acquire_rfutex(test_futex, gettid());
+	pass++;
 
 	/*
 	 * Now exit instead of releasing the futex. This should cause
 	 * the kernel to wake the next waiter with FUTEX_OWNER_DIED.
 	 */
+do_exit:
 	log("INFO", "exiting\n");
-	pass++;
 	if (pass && !fail)
 		exit(EXIT_SUCCESS);
 	exit(EXIT_FAILURE);
-- 
1.5.6.3


_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux