X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_cmd_putval.c;h=bf3e2b6f2b9880cf50f6d602bf721ed42c51afb7;hb=958f7776a2daaa1a8664aded0a2c1d717c2f5909;hp=7b6a39d7fab1307692d8703adf80a5b0e795419d;hpb=53de2cf4354da65843104ea430d6fdf0375a0c64;p=collectd.git diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c index 7b6a39d7..bf3e2b6f 100644 --- a/src/utils_cmd_putval.c +++ b/src/utils_cmd_putval.c @@ -25,10 +25,12 @@ **/ #include "collectd.h" + #include "common.h" #include "plugin.h" #include "utils_parse_option.h" +#include "utils_cmd_putval.h" #define print_to_socket(fh, ...) \ do { \ @@ -162,7 +164,7 @@ int handle_putval (FILE *fh, char *buffer) sfree (identifier_copy); vl.values_len = ds->ds_num; - vl.values = (value_t *) malloc (vl.values_len * sizeof (value_t)); + vl.values = malloc (vl.values_len * sizeof (*vl.values)); if (vl.values == NULL) { print_to_socket (fh, "-1 malloc failed.\n"); @@ -217,8 +219,8 @@ int handle_putval (FILE *fh, char *buffer) } /* while (*buffer != 0) */ /* Done parsing the options. */ - if (fh!=stdout) - print_to_socket (fh, "0 Success: %i %s been dispatched.\n", + if (fh!=stdout) + print_to_socket (fh, "0 Success: %i %s been dispatched.\n", values_submitted, (values_submitted == 1) ? "value has" : "values have");