X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnut.c;h=552359e7c66ca841e52acdb589c97bf779265366;hb=f165a8908666d40e23eaff3faf0ae3195044f1b6;hp=1d1e94b521cc9fdd02a19e58e828ba2c182d3795;hpb=ec51ddee94fa2ba1e01fe0e336ccc9c190a198ff;p=collectd.git diff --git a/src/nut.c b/src/nut.c index 1d1e94b5..552359e7 100644 --- a/src/nut.c +++ b/src/nut.c @@ -27,8 +27,8 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" #include @@ -100,8 +100,10 @@ static int nut_add_ups(const char *name) { /* name = */ cb_name, /* callback = */ nut_read, /* interval = */ 0, - /* user_data = */ &(user_data_t){ - .data = ups, .free_func = free_nut_ups_t, + /* user_data = */ + &(user_data_t){ + .data = ups, + .free_func = free_nut_ups_t, }); sfree(cb_name); @@ -144,8 +146,7 @@ static int nut_verify_peer(const char *value) { static int nut_ca_path(const char *value) { if (value != NULL && strcmp(value, "") != 0) { - ca_path = malloc(strlen(value) + 1); - strncpy(ca_path, value, (strlen(value) + 1)); + ca_path = strdup(value); } else { ca_path = NULL; // Should alread be set to NULL from initialization }