From: Sebastian Harl Date: Fri, 17 Jun 2011 08:29:13 +0000 (+0200) Subject: rrdcached plugin: Handle boolean config options as well. X-Git-Tag: collectd-5.1.0~53 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=5caecf5ba53ad31fa0626591c1ccc91fb47af955;p=collectd.git rrdcached plugin: Handle boolean config options as well. This was lost previously when changing to the complex config callback. --- diff --git a/src/rrdcached.c b/src/rrdcached.c index f53ccad7..11c1c6a7 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -164,13 +164,20 @@ static int value_list_to_filename (char *buffer, int buffer_len, static const char *config_get_string (oconfig_item_t *ci) { if ((ci->children_num != 0) || (ci->values_num != 1) - || (ci->values[0].type != OCONFIG_TYPE_STRING)) + || ((ci->values[0].type != OCONFIG_TYPE_STRING) + && (ci->values[0].type != OCONFIG_TYPE_BOOLEAN))) { ERROR ("rrdcached plugin: %s expects a single string argument.", ci->key); return (NULL); } + if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN) { + if (ci->values[0].value.boolean) + return "true"; + else + return "false"; + } return (ci->values[0].value.string); } /* const char *config_get_string */