- char errbuf[1024];
- ERROR ("write_graphite plugin: Connecting to %s:%s failed. "
- "The last error was: %s", node, service,
- sstrerror (errno, errbuf, sizeof (errbuf)));
- close (cb->sock_fd);
+ 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 failed. "
+ "The last error was: %s", node, service, connerr);