diff --git a/src/write_graphite.c b/src/write_graphite.c
index c3d6bf103490a7f2f4dfeefe33f6d42db0f9f39b..c17b7f36a6dc787e1eeac749388f5a8f6c5e8123 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
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;