X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fpowerdns.c;h=f9f291aed08b924cf6c9940e1020bc1b80ec647a;hb=81a5fd5046c6a39f580a8fc1a3af837fd5f5aa5c;hp=99b4df68d9e6bd1a827f27a2a4b7ada67283d19d;hpb=09c6a320f3cb36b5dbb2c2ce43858f33be7acf9b;p=collectd.git diff --git a/src/powerdns.c b/src/powerdns.c index 99b4df68..f9f291ae 100644 --- a/src/powerdns.c +++ b/src/powerdns.c @@ -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 */