write_graphite: avoid printing out the NULL value in error messages
authorWilfried Goesgens <dothebart@citadel.org>
Tue, 17 Sep 2013 19:15:02 +0000 (21:15 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Sat, 21 Sep 2013 13:39:09 +0000 (15:39 +0200)
src/write_graphite.c

index 667c11e..c3d6bf1 100644 (file)
@@ -131,8 +131,10 @@ static int wg_send_buffer (struct wg_callback *cb)
     if (cb->log_send_errors && 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, cb->protocol,
+                cb->node, cb->service, protocol,
                 status, sstrerror (errno, errbuf, sizeof (errbuf)));