X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fnut.c;h=ae48692b8b15204f1e3f73e73ad41aee8be4fc4a;hb=25824c65721f0f21cadf1607fad367c7e7831816;hp=a51c4c0b9cb0e9120e121559c57322af698eaeda;hpb=a396da422740caf336a6d594515e8d80de6f440a;p=collectd.git diff --git a/src/nut.c b/src/nut.c index a51c4c0b..ae48692b 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 @@ -53,8 +53,8 @@ struct nut_ups_s { static const char *config_keys[] = {"UPS", "FORCESSL", "VERIFYPEER", "CAPATH", "CONNECTTIMEOUT"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); -static int force_ssl = 0; // Initialized to default of 0 (false) -static int verify_peer = 0; // Initialized to default of 0 (false) +static int force_ssl; // Initialized to default of 0 (false) +static int verify_peer; // Initialized to default of 0 (false) static int ssl_flags = UPSCLI_CONN_TRYSSL; static int connect_timeout = -1; static char *ca_path; @@ -144,8 +144,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 }