X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fpowerdns.c;h=d28f5698000a93317c01970724660726c645403b;hb=c0a95e555ed8b58af9ff9e476ce1c13241a21ae3;hp=99b4df68d9e6bd1a827f27a2a4b7ada67283d19d;hpb=09c6a320f3cb36b5dbb2c2ce43858f33be7acf9b;p=collectd.git diff --git a/src/powerdns.c b/src/powerdns.c index 99b4df68..d28f5698 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -298,7 +298,7 @@ static void submit (const char *plugin_instance, /* {{{ */ if (ds->ds_num != 1) { - ERROR ("powerdns plugin: type `%s' has %i data sources, " + ERROR ("powerdns plugin: type `%s' has %zu data sources, " "but I can only handle one.", type, ds->ds_num); return; @@ -737,25 +737,6 @@ static int powerdns_read_recursor (list_item_t *item) /* {{{ */ return (0); } /* }}} int powerdns_read_recursor */ -static int powerdns_config_add_string (const char *name, /* {{{ */ - char **dest, - oconfig_item_t *ci) -{ - if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING)) - { - WARNING ("powerdns plugin: `%s' needs exactly one string argument.", - name); - return (-1); - } - - sfree (*dest); - *dest = strdup (ci->values[0].value.string); - if (*dest == NULL) - return (-1); - - return (0); -} /* }}} int powerdns_config_add_string */ - static int powerdns_config_add_collect (list_item_t *li, /* {{{ */ oconfig_item_t *ci) { @@ -866,7 +847,7 @@ static int powerdns_config_add_server (oconfig_item_t *ci) /* {{{ */ if (strcasecmp ("Collect", option->key) == 0) status = powerdns_config_add_collect (item, option); else if (strcasecmp ("Socket", option->key) == 0) - status = powerdns_config_add_string ("Socket", &socket_temp, option); + status = cf_util_get_string (option, &socket_temp); else { ERROR ("powerdns plugin: Option `%s' not allowed here.", option->key); @@ -906,12 +887,14 @@ static int powerdns_config_add_server (oconfig_item_t *ci) /* {{{ */ if (status != 0) { + sfree (socket_temp); sfree (item); return (-1); } DEBUG ("powerdns plugin: Add server: instance = %s;", item->instance); + sfree (socket_temp); return (0); } /* }}} int powerdns_config_add_server */