From 4267e589be114e837b06ad0b40fc58cdf7ea080a Mon Sep 17 00:00:00 2001 From: Pierre-Marc Fournier Date: Wed, 14 Jul 2010 21:05:16 -0400 Subject: [PATCH] add paranoid check before listener thread destruction In case a pthread error prevented its creation. --- libust/tracectl.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libust/tracectl.c b/libust/tracectl.c index 2f9215e..0322037 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)); -- 2.34.1