From: Pierre-Marc Fournier Date: Thu, 15 Jul 2010 01:05:16 +0000 (-0400) Subject: add paranoid check before listener thread destruction X-Git-Tag: v1.9.1~573 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4267e589be114e837b06ad0b40fc58cdf7ea080a;p=lttng-ust.git add paranoid check before listener thread destruction In case a pthread error prevented its creation. --- diff --git a/libust/tracectl.c b/libust/tracectl.c index 2f9215e6..03220373 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -1070,8 +1070,9 @@ void create_listener(void) if(result) { PERROR("pthread_sigmask: %s", strerror(result)); } - - have_listener = 1; + else { + have_listener = 1; + } } static int init_socket(void) @@ -1369,10 +1370,13 @@ int restarting_usleep(useconds_t usecs) return result; } -static void stop_listener() +static void stop_listener(void) { int result; + if(!have_listener) + return; + result = pthread_cancel(listener_thread); if(result != 0) { ERR("pthread_cancel: %s", strerror(result));