X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdaemon%2Fconfigfile.c;h=c500d3eeb1ffecd46c03056075b807967aa5a0b9;hb=28a82858cb615355ba646f4a10f89bcf69a4abb6;hp=8750bef87b84a45313e82004319945815f2b74ad;hpb=a9191cc20f0a5af022ae1d9482af2eaf0098a46a;p=collectd.git diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index 8750bef8..c500d3ee 100644 --- a/src/daemon/configfile.c +++ b/src/daemon/configfile.c @@ -29,11 +29,11 @@ #include "liboconfig/oconfig.h" -#include "common.h" #include "configfile.h" #include "filter_chain.h" #include "plugin.h" #include "types_list.h" +#include "utils/common/common.h" #if HAVE_WORDEXP_H #include @@ -411,10 +411,14 @@ static int dispatch_block_plugin(oconfig_item_t *ci) { } /* Hm, no complex plugin found. Dispatch the values one by one */ - for (int i = 0; i < ci->children_num; i++) { - if (ci->children[i].children == NULL) - dispatch_value_plugin(name, ci->children + i); - else { + for (int i = 0, ret = 0; i < ci->children_num; i++) { + if (ci->children[i].children == NULL) { + ret = dispatch_value_plugin(name, ci->children + i); + if (ret != 0) { + ERROR("dispatch for plugin %s returned non-zero code : %i", name, ret); + return ret; + } + } else { WARNING("There is a `%s' block within the " "configuration for the %s plugin. " "The plugin either only expects " @@ -1064,7 +1068,7 @@ int cf_util_get_string(const oconfig_item_t *ci, char **ret_string) /* {{{ */ } /* }}} int cf_util_get_string */ /* Assures the config option is a string and copies it to the provided buffer. - * Assures null-termination. */ + * Assures NUL-termination. */ int cf_util_get_string_buffer(const oconfig_item_t *ci, char *buffer, /* {{{ */ size_t buffer_size) { if ((ci == NULL) || (buffer == NULL) || (buffer_size < 1)) @@ -1076,7 +1080,7 @@ int cf_util_get_string_buffer(const oconfig_item_t *ci, char *buffer, /* {{{ */ } strncpy(buffer, ci->values[0].value.string, buffer_size); - buffer[buffer_size - 1] = 0; + buffer[buffer_size - 1] = '\0'; return 0; } /* }}} int cf_util_get_string_buffer */