From: Marc Fournier Date: Mon, 24 Nov 2014 08:23:18 +0000 (+0100) Subject: Merge branch 'collectd-5.3' into collectd-5.4 X-Git-Tag: collectd-5.4.2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=61bda3c7438f57086b0fcf87cc54407efcbaf9e3;p=collectd.git Merge branch 'collectd-5.3' into collectd-5.4 Conflicts: src/write_graphite.c --- 61bda3c7438f57086b0fcf87cc54407efcbaf9e3 diff --cc src/write_graphite.c index c17b7f36,392d5700..504ea9d4 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@@ -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); @@@ -239,11 -226,12 +248,12 @@@ 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