ping plugin: Protect access to ping_thread_error.
authorFlorian Forster <octo@collectd.org>
Tue, 8 Dec 2015 13:38:05 +0000 (14:38 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 8 Dec 2015 13:38:05 +0000 (14:38 +0100)
This is primarily to make Coverity happy.

CID: 37976

src/ping.c

index e1a3109..ecbbd9d 100644 (file)
@@ -416,8 +416,10 @@ static int stop_thread (void) /* {{{ */
     status = -1;
   }
 
+  pthread_mutex_lock (&ping_lock);
   memset (&ping_thread_id, 0, sizeof (ping_thread_id));
   ping_thread_error = 0;
+  pthread_mutex_unlock (&ping_lock);
 
   return (status);
 } /* }}} int stop_thread */