From: Jim Radford Date: Thu, 8 Aug 2013 16:31:46 +0000 (-0700) Subject: curl_json plugin: use sstrerr for thread safety X-Git-Tag: collectd-5.4.0~3^2~2^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b622ba07c48d81d44c6a8828b44eb7989b50477e;p=collectd.git curl_json plugin: use sstrerr for thread safety --- diff --git a/src/curl_json.c b/src/curl_json.c index de66862c..253ca27d 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -774,6 +774,7 @@ static void cj_submit (cj_t *db, cj_key_t *key, value_t *value) /* {{{ */ static int cj_sock_perform (cj_t *db) /* {{{ */ { + char errbuf[1024]; struct sockaddr_un sa_unix = {}; sa_unix.sun_family = AF_UNIX; sstrncpy (sa_unix.sun_path, db->sock, sizeof (sa_unix.sun_path)); @@ -784,7 +785,8 @@ static int cj_sock_perform (cj_t *db) /* {{{ */ if (connect (fd, (struct sockaddr *)&sa_unix, sizeof(sa_unix)) < 0) { ERROR ("curl_json plugin: connect(%s) failed: %s", - (db->sock != NULL) ? db->sock : "", strerror(errno)); + (db->sock != NULL) ? db->sock : "", + sstrerror(errno, errbuf, sizeof (errbuf))); close (fd); return (-1); } @@ -795,7 +797,8 @@ static int cj_sock_perform (cj_t *db) /* {{{ */ red = read (fd, buffer, sizeof(buffer)); if (red < 0) { ERROR ("curl_json plugin: read(%s) failed: %s", - (db->sock != NULL) ? db->sock : "", strerror(errno)); + (db->sock != NULL) ? db->sock : "", + sstrerror(errno, errbuf, sizeof (errbuf))); close (fd); return (-1); }