Merge branch 'collectd-5.3' into collectd-5.4
authorMarc Fournier <marc.fournier@camptocamp.com>
Mon, 24 Nov 2014 08:23:18 +0000 (09:23 +0100)
committerMarc Fournier <marc.fournier@camptocamp.com>
Mon, 24 Nov 2014 08:23:18 +0000 (09:23 +0100)
Conflicts:
src/write_graphite.c

1  2 
src/Makefile.am
src/collectd.conf.pod
src/plugin.c
src/write_graphite.c

diff --cc src/Makefile.am
Simple merge
Simple merge
diff --cc src/plugin.c
Simple merge
@@@ -190,8 -173,9 +190,10 @@@ static int wg_callback_init (struct wg_
  
      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