lib/tst_test.c: do all cleanup in do_exit
Since previous patch, library process can exit only by calling
do_exit(). This patch moves all cleanup to do_cleanup(),
which is called only from a single place at do_exit().
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 6e6d417..9f9a41b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -64,6 +64,7 @@
static char shm_path[1024];
+static void do_cleanup(void);
static void do_exit(int ret) __attribute__ ((noreturn));
static void setup_ipc(void)
@@ -460,7 +461,7 @@
if (results->warnings)
ret |= TWARN;
- cleanup_ipc();
+ do_cleanup();
exit(ret);
}
@@ -577,6 +578,8 @@
tst_futexes = NULL;
tst_rmdir();
}
+
+ cleanup_ipc();
}
static void run_tests(void)
@@ -714,8 +717,6 @@
alarm(0);
- do_cleanup();
-
if (WIFEXITED(status) && WEXITSTATUS(status))
do_exit(WEXITSTATUS(status));