X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fdaemon%2Fconfigfile.c;h=735be83dd19bf9481ade811db2870efd69c83dea;hb=e61fe698d4a120c75a1fb1e75535b887382150f0;hp=8750bef87b84a45313e82004319945815f2b74ad;hpb=81bda22a4ebb3f60bf665048517ce65d77cc6501;p=collectd.git diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index 8750bef8..735be83d 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,12 @@ 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) + return ret; + } else { WARNING("There is a `%s' block within the " "configuration for the %s plugin. " "The plugin either only expects " @@ -1064,7 +1066,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 +1078,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 */