X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fping.c;h=88661e94ba5a5e60c99281a9fffc26d6c3265849;hb=d41585ea72b7e2768c4dd507016ffd0cc3a6e130;hp=85421647b1a0507cb6edf5598e52ca1ccbcf6fef;hpb=090e054043f6d93b374dee20d766c4f906acd43a;p=collectd.git diff --git a/src/ping.c b/src/ping.c index 85421647..88661e94 100644 --- a/src/ping.c +++ b/src/ping.c @@ -244,7 +244,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 +399,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 +427,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 +483,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];