From: Florian Forster Date: Thu, 30 Nov 2017 16:11:49 +0000 (+0100) Subject: Merge branch 'collectd-5.7' into collectd-5.8 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3d082a905619c19ca5b7183bb95a30d4d9529c4d;p=collectd.git Merge branch 'collectd-5.7' into collectd-5.8 --- 3d082a905619c19ca5b7183bb95a30d4d9529c4d diff --cc src/aggregation.c index 5fea279c,272a04fb..0ed97ae1 --- a/src/aggregation.c +++ b/src/aggregation.c @@@ -504,14 -507,10 +505,10 @@@ static int agg_config_handle_group_by(o static int agg_config_aggregation(oconfig_item_t *ci) /* {{{ */ { - aggregation_t *agg; - _Bool is_valid; - int status; - - agg = calloc(1, sizeof(*agg)); + aggregation_t *agg = calloc(1, sizeof(*agg)); if (agg == NULL) { ERROR("aggregation plugin: calloc failed."); - return (-1); + return -1; } sstrncpy(agg->ident.host, "/.*/", sizeof(agg->ident.host)); @@@ -631,13 -636,12 +634,12 @@@ is_valid = 0; } /* }}} */ - if (!is_valid) /* {{{ */ - { + if (!is_valid) { /* {{{ */ sfree(agg); - return (-1); + return -1; } /* }}} */ - status = lookup_add(lookup, &agg->ident, agg->group_by, agg); + int status = lookup_add(lookup, &agg->ident, agg->group_by, agg); if (status != 0) { ERROR("aggregation plugin: lookup_add failed with status %i.", status); sfree(agg); diff --cc src/ping.c index 6e056e46,03dea6db..8cefeed4 --- a/src/ping.c +++ b/src/ping.c @@@ -235,14 -233,13 +233,13 @@@ static void *ping_thread(void *arg) /* c_complain_t complaint = C_COMPLAIN_INIT_STATIC; - pthread_mutex_lock(&ping_lock); - - pingobj = ping_construct(); + pingobj_t *pingobj = ping_construct(); if (pingobj == NULL) { ERROR("ping plugin: ping_construct failed."); + pthread_mutex_lock(&ping_lock); ping_thread_error = 1; pthread_mutex_unlock(&ping_lock); - return ((void *)-1); + return (void *)-1; } if (ping_source != NULL) @@@ -276,9 -273,10 +273,10 @@@ if (count == 0) { ERROR("ping plugin: No host could be added to ping object. Giving up."); + pthread_mutex_lock(&ping_lock); ping_thread_error = 1; pthread_mutex_unlock(&ping_lock); - return ((void *)-1); + return (void *)-1; } /* Set up `ts_int' */