summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 654c160)
raw | patch | inline | side by side (parent: 654c160)
author | J. Javier Maestro <jjmaestro@ieee.org> | |
Sun, 16 Jun 2013 16:05:53 +0000 (18:05 +0200) | ||
committer | J. Javier Maestro <jjmaestro@ieee.org> | |
Sun, 16 Jun 2013 16:55:26 +0000 (18:55 +0200) |
This is the preferred way of handling config, as it can be seen in snmp.c. It's
important to fail on a config error to simplify code in other callbacks.
important to fail on a config error to simplify code in other callbacks.
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 546111bb1ba998f2122d424b1d92a42de273609e..c264932f5e52ec71a4083fdfdf3be3b2652af074 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
user_data_t user_data;
char callback_name[DATA_MAX_NAME_LEN];
int i;
+ int status = 0;
cb = malloc (sizeof (*cb));
if (cb == NULL)
/* FIXME: Legacy configuration syntax. */
if (strcasecmp ("Carbon", ci->key) != 0)
{
- int status = cf_util_get_string (ci, &cb->name);
+ status = cf_util_get_string (ci, &cb->name);
if (status != 0)
{
wg_callback_free (cb);
{
ERROR ("write_graphite plugin: Invalid configuration "
"option: %s.", child->key);
+ status = -1;
}
+
+ if (status != 0)
+ break;
+ }
+
+ if (status != 0)
+ {
+ wg_callback_free (cb);
+ return (status);
}
/* FIXME: Legacy configuration syntax. */