summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2013-01-26 11:09:15 -0800
committerPieter Noordhuis <pcnoordhuis@gmail.com>2013-01-26 11:09:15 -0800
commit9df327e8fddef1e17b2136b5f42be58f46cdbc08 (patch)
tree380b73eb3d1e2a1e90bc1a8ef89be31eb3cdb098
parent3c46b13a62164d9f3f99289476f84db7918aafc2 (diff)
parentbf161d996fcab9cf351b2fdb851a9db5f275103b (diff)
Merge pull request #119 from thefab/fix99
Try again later for EINTR errors (see issue #99)
-rw-r--r--hiredis.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hiredis.c b/hiredis.c
index 4709ee3..50028ee 100644
--- a/hiredis.c
+++ b/hiredis.c
@@ -1077,7 +1077,7 @@ int redisBufferRead(redisContext *c) {
nread = read(c->fd,buf,sizeof(buf));
if (nread == -1) {
- if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
+ if ((errno == EAGAIN && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);
@@ -1114,7 +1114,7 @@ int redisBufferWrite(redisContext *c, int *done) {
if (sdslen(c->obuf) > 0) {
nwritten = write(c->fd,c->obuf,sdslen(c->obuf));
if (nwritten == -1) {
- if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
+ if ((errno == EAGAIN && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);