From 712c0a416128c6c742dd2721140222a28c009c22 Mon Sep 17 00:00:00 2001 From: Jim Radford Date: Thu, 8 Aug 2013 09:31:46 -0700 Subject: [PATCH] curl_json plugin: use sstrerr for thread safety --- src/curl_json.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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); } -- 2.30.2