From: Christian Brauner Date: Tue, 10 Mar 2020 15:23:11 +0000 (+0100) Subject: tests/share_ns: always call pthread_exit() X-Git-Tag: lxc-4.0.0~39^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b9aca115e71febd5b307b3eb5e69528e2f2ad0c;p=thirdparty%2Flxc.git tests/share_ns: always call pthread_exit() Signed-off-by: Christian Brauner --- diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index ac0e2f312..2a2ba163c 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -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 diff --git a/src/tests/share_ns.c b/src/tests/share_ns.c index f020904f5..ea812d2cd 100644 --- a/src/tests/share_ns.c +++ b/src/tests/share_ns.c @@ -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[])