ssize_t status = 0;
status = swrite (cb->sock_fd, cb->send_buf, strlen (cb->send_buf));
- if (cb->log_send_errors && status < 0)
+ if (status < 0)
{
- char errbuf[1024];
const char *protocol = cb->protocol ? cb->protocol : WG_DEFAULT_PROTOCOL;
- ERROR ("write_graphite plugin: send to %s:%s (%s) failed with status %zi (%s)",
- cb->node, cb->service, protocol,
- status, sstrerror (errno, errbuf, sizeof (errbuf)));
-
+ if (cb->log_send_errors)
+ {
+ char errbuf[1024];
+ ERROR ("write_graphite plugin: send to %s:%s (%s) failed with status %zi (%s)",
+ cb->node, cb->service, protocol,
+ status, sstrerror (errno, errbuf, sizeof (errbuf)));
+ }
close (cb->sock_fd);
cb->sock_fd = -1;