From: Florian Forster Date: Fri, 21 Nov 2014 09:39:50 +0000 (+0100) Subject: mqtt plugin: Use the thread-safe sstrerror(). X-Git-Tag: collectd-5.6.0~637^2~13 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b260f7243a91ea42baf0038bc703bb862f4d2ad5;p=collectd.git mqtt plugin: Use the thread-safe sstrerror(). --- diff --git a/src/mqtt.c b/src/mqtt.c index b7f5de84..c5254375 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -95,18 +95,20 @@ static int mqtt_reconnect_broker (mqtt_client_conf_t *conf) status = mosquitto_reconnect (conf->mosq); if (status != MOSQ_ERR_SUCCESS) { + char errbuf[1024]; ERROR ("mqtt_connect_broker: mosquitto_connect failed: %s", - (status == MOSQ_ERR_ERRNO ? - strerror(errno) : mosquitto_strerror (status))); + (status == MOSQ_ERR_ERRNO) + ? sstrerror(errno, errbuf, sizeof (errbuf)) + : mosquitto_strerror (status)); return (-1); } conf->connected = 1; c_release (LOG_INFO, - &conf->complaint_cantpublish, - "mqtt plugin: successfully reconnected to broker \"%s:%d\"", - conf->host, conf->port); + &conf->complaint_cantpublish, + "mqtt plugin: successfully reconnected to broker \"%s:%d\"", + conf->host, conf->port); return (0); } /* mqtt_reconnect_broker */