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;
+ char connerr[1024] = "";
+
if (cb->sock_fd > 0)
return (0);
if (cb->sock_fd < 0)
{
- char errbuf[1024];
+ if (connerr[0] == '\0')
+ /* this should not happen but try to get a message anyway */
+ 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,
- sstrerror (errno, errbuf, sizeof (errbuf)));
- "write_graphite plugin: Connecting to %s:%s failed. "
- "The last error was: %s", node, service, connerr);
++ "write_graphite plugin: Connecting to %s:%s via %s failed. "
++ "The last error was: %s", node, service, protocol, connerr);
return (-1);
}
else