X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fdaemon%2Fconfigfile.c;h=8bf6b8d7e69a92e62521cd3618b1938c7635c2eb;hb=6378ec288f34ff250b2971a1452338a2b34c240a;hp=d9038002ad2d418105037287a1f60c352327ee0f;hpb=ed33542f4c8e61c00d76eb7f1d3d14e04a575050;p=collectd.git diff --git a/src/daemon/configfile.c b/src/daemon/configfile.c index d9038002..8bf6b8d7 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 @@ -381,6 +381,7 @@ static int dispatch_block_plugin(oconfig_item_t *ci) { /* default to the global interval set before loading this plugin */ ctx.interval = cf_get_default_interval(); + ctx.name = strdup(name); old_ctx = plugin_set_ctx(ctx); status = plugin_load(name, /* flags = */ false); @@ -1063,7 +1064,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)) @@ -1075,7 +1076,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 */