diff options
author | Jan-Erik Rediger <badboy@archlinux.us> | 2017-01-23 17:03:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-23 17:03:14 +0100 |
commit | c9b72f97f8252bf447e7421b9d929410593f60c1 (patch) | |
tree | 7787f0480b9a66359560728377a6cad624d531ae | |
parent | 33152ad163a21f568fb40eeeb88b79365886b4ea (diff) | |
parent | 25cd884f6b494a88bd491a8d9a50486e3f1e6751 (diff) |
Merge pull request #499 from jinq0123/fixbug/redisSetErrorFromErrno
Fix __redisSetErrorFromErrno() can not get error string.
-rw-r--r-- | net.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -65,12 +65,13 @@ static void redisContextCloseFd(redisContext *c) { } static void __redisSetErrorFromErrno(redisContext *c, int type, const char *prefix) { + int errorno = errno; /* snprintf() may change errno */ char buf[128] = { 0 }; size_t len = 0; if (prefix != NULL) len = snprintf(buf,sizeof(buf),"%s: ",prefix); - __redis_strerror_r(errno, (char *)(buf + len), sizeof(buf) - len); + __redis_strerror_r(errorno, (char *)(buf + len), sizeof(buf) - len); __redisSetError(c,type,buf); } |