add paranoid check before listener thread destruction
authorPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 15 Jul 2010 01:05:16 +0000 (21:05 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Thu, 15 Jul 2010 01:05:16 +0000 (21:05 -0400)
In case a pthread error prevented its creation.

libust/tracectl.c

index 2f9215e65b29adc0df6095ce72c206425304c559..03220373c92dee9c7eea7ee259d231de8924b809 100644 (file)
@@ -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));
This page took 0.02529 seconds and 4 git commands to generate.