X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fping.c;h=e16ba07706b24a0eddee4c4a13a0d51d30bb6ef4;hb=2ad8a45bd68821c7c4817d148100c6700d35d324;hp=85421647b1a0507cb6edf5598e52ca1ccbcf6fef;hpb=090e054043f6d93b374dee20d766c4f906acd43a;p=collectd.git diff --git a/src/ping.c b/src/ping.c index 85421647..e16ba077 100644 --- a/src/ping.c +++ b/src/ping.c @@ -30,7 +30,6 @@ #include "configfile.h" #include "utils_complain.h" -#include #include #if HAVE_NETDB_H # include /* NI_MAXHOST */ @@ -244,7 +243,7 @@ static int ping_dispatch_all (pingobj_t *pingobj) /* {{{ */ static void *ping_thread (void *arg) /* {{{ */ { - static pingobj_t *pingobj = NULL; + pingobj_t *pingobj = NULL; struct timeval tv_begin; struct timeval tv_end; @@ -399,7 +398,7 @@ static int start_thread (void) /* {{{ */ pthread_mutex_unlock (&ping_lock); return (-1); } - + pthread_mutex_unlock (&ping_lock); return (0); } /* }}} int start_thread */ @@ -427,8 +426,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 */ @@ -481,7 +482,7 @@ static int ping_config (const char *key, const char *value) /* {{{ */ hostlist_t *hl; char *host; - hl = (hostlist_t *) malloc (sizeof (hostlist_t)); + hl = malloc (sizeof (*hl)); if (hl == NULL) { char errbuf[1024];