summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: de80d27)
raw | patch | inline | side by side (parent: de80d27)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 24 Jul 2015 20:37:36 +0000 (22:37 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Fri, 24 Jul 2015 20:37:36 +0000 (22:37 +0200) |
src/write_graphite.c | patch | blob | history |
diff --git a/src/write_graphite.c b/src/write_graphite.c
index e9eac87f442cf677568cdb2a0f98dbf63ca69698..639b055d929fa4771de6f398ce9f98522b5d4750 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
cdtime_t now;
int status;
- const char *node = cb->node ? cb->node : WG_DEFAULT_NODE;
const char *service = cb->service ? cb->service : WG_DEFAULT_SERVICE;
const char *protocol = cb->protocol ? cb->protocol : WG_DEFAULT_PROTOCOL;
ai_list = NULL;
- status = getaddrinfo (node, service, &ai_hints, &ai_list);
+ status = getaddrinfo (cb->node, service, &ai_hints, &ai_list);
if (status != 0)
{
ERROR ("write_graphite plugin: getaddrinfo (%s, %s, %s) failed: %s",
- node, service, protocol, gai_strerror (status));
+ cb->node, service, protocol, gai_strerror (status));
return (-1);
}
sstrerror (errno, connerr, sizeof (connerr));
c_complain (LOG_ERR, &cb->init_complaint,
"write_graphite plugin: Connecting to %s:%s via %s failed. "
- "The last error was: %s", node, service, protocol, connerr);
+ "The last error was: %s", cb->node, service, protocol, connerr);
return (-1);
}
else
{
c_release (LOG_INFO, &cb->init_complaint,
"write_graphite plugin: Successfully connected to %s:%s via %s.",
- node, service, protocol);
+ cb->node, service, protocol);
}
wg_reset_buffer (cb);
memset (cb, 0, sizeof (*cb));
cb->sock_fd = -1;
cb->name = NULL;
- cb->node = NULL;
+ cb->node = strdup (WG_DEFAULT_NODE);
cb->service = NULL;
cb->protocol = NULL;
cb->log_send_errors = WG_DEFAULT_LOG_SEND_ERRORS;
/* FIXME: Legacy configuration syntax. */
if (cb->name == NULL)
ssnprintf (callback_name, sizeof (callback_name), "write_graphite/%s/%s/%s",
- cb->node != NULL ? cb->node : WG_DEFAULT_NODE,
+ cb->node,
cb->service != NULL ? cb->service : WG_DEFAULT_SERVICE,
cb->protocol != NULL ? cb->protocol : WG_DEFAULT_PROTOCOL);
else