]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tests/share_ns: always call pthread_exit()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 10 Mar 2020 15:23:11 +0000 (16:23 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 10 Mar 2020 15:39:03 +0000 (16:39 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/tests/Makefile.am
src/tests/share_ns.c

index ac0e2f3127ba725fe108e7f08451772508af500c..2a2ba163c421a517e67e0a8de03497b4609c943e 100644 (file)
@@ -34,7 +34,9 @@ lxc_test_raw_clone_SOURCES = lxc_raw_clone.c \
                             ../lxc/utils.c ../lxc/utils.h
 lxc_test_reboot_SOURCES = reboot.c
 lxc_test_saveconfig_SOURCES = saveconfig.c
-lxc_test_share_ns_SOURCES = share_ns.c lxctest.h
+lxc_test_share_ns_SOURCES = share_ns.c \
+                           lxctest.h \
+                           ../lxc/compiler.h
 lxc_test_shortlived_SOURCES = shortlived.c
 lxc_test_shutdowntest_SOURCES = shutdowntest.c
 lxc_test_snapshot_SOURCES = snapshot.c
index f020904f5f23873cb13149669078f280300e38f0..ea812d2cd55b88b4603f82bcf5afd5133bbb89c7 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "lxc/lxccontainer.h"
 #include "lxctest.h"
+#include "../lxc/compiler.h"
 
 struct thread_args {
        int thread_id;
@@ -39,7 +40,7 @@ struct thread_args {
        char inherited_net_ns[4096];
 };
 
-void *ns_sharing_wrapper(void *data)
+__noreturn void *ns_sharing_wrapper(void *data)
 {
        int init_pid;
        ssize_t ret;
@@ -56,7 +57,7 @@ void *ns_sharing_wrapper(void *data)
        c = lxc_container_new(name, NULL);
        if (!c) {
                lxc_error("Failed to create container \"%s\"\n", name);
-               return NULL;
+               goto out_pthread_exit;
        }
 
        if (c->is_defined(c)) {
@@ -168,8 +169,8 @@ out:
        if (!c->destroy(c))
                lxc_error("Failed to destroy container \"%s\"\n", name);
 
+out_pthread_exit:
        pthread_exit(NULL);
-       return NULL;
 }
 
 int main(int argc, char *argv[])