summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f6eb6ef)
raw | patch | inline | side by side (parent: f6eb6ef)
author | Florian Forster <octo@collectd.org> | |
Thu, 9 Feb 2012 09:48:50 +0000 (10:48 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 9 Feb 2012 09:48:50 +0000 (10:48 +0100) |
Change-Id: Ia99e2c8d9c7ced344bb52f4d80957fa9abe3e7db
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 857258a6294a7b0b232aa79d06ae2523c50d284f..b7924ba8c2d0166bfa8ead827f544eefd2005929 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
static int config_set_char (char *dest,
oconfig_item_t *ci)
{
- if ((ci->values_num != 1) || (ci->values[0].type != OCONFIG_TYPE_STRING))
+ char buffer[4];
+ int status;
+
+ memset (buffer, 0, sizeof (buffer));
+
+ status = cf_util_get_string_buffer (ci, buffer, sizeof (buffer));
+ if (status != 0)
+ return (status);
+
+ if (buffer[0] == 0)
{
- WARNING ("write_graphite plugin: The `%s' config option "
- "needs exactly one string argument.", ci->key);
+ ERROR ("write_graphite plugin: Cannot use an empty string for the "
+ "\"EscapeCharacter\" option.");
return (-1);
}
- *dest = ci->values[0].value.string[0];
+ if (buffer[1] != 0)
+ {
+ WARNING ("write_graphite plugin: Only the first character of the "
+ "\"EscapeCharacter\" option ('%c') will be used.",
+ (int) buffer[0]);
+ }
+
+ *dest = buffer[0];
return (0);
}