Skip to content

Commit

Permalink
tests/share_ns: always call pthread_exit()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Mar 10, 2020
1 parent 9b53e0b commit 1b9aca1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/tests/Makefile.am
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions src/tests/share_ns.c
Expand Up @@ -30,6 +30,7 @@

#include "lxc/lxccontainer.h"
#include "lxctest.h"
#include "../lxc/compiler.h"

struct thread_args {
int thread_id;
Expand All @@ -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;
Expand All @@ -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)) {
Expand Down Expand Up @@ -168,8 +169,8 @@ void *ns_sharing_wrapper(void *data)
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[])
Expand Down

0 comments on commit 1b9aca1

Please sign in to comment.