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 <[email protected]>
Cc: [email protected]
---
 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
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/containers

_______________________________________________
Devel mailing list
[email protected]
https://openvz.org/mailman/listinfo/devel

Reply via email to