X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/dd4e8203b2e9d79af5ed96562488415ca8a74815..4934f93dfb30c93a1636e3227584e791cd062bfb:/src/redis-cli.c diff --git a/src/redis-cli.c b/src/redis-cli.c index 1603c2d0..f4855879 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -1009,7 +1010,7 @@ static void pipeMode(void) { /* Read from socket and feed the hiredis reader. */ do { nread = read(fd,ibuf,sizeof(ibuf)); - if (nread == -1 && errno != EAGAIN) { + if (nread == -1 && errno != EAGAIN && errno != EINTR) { fprintf(stderr, "Error reading from the server: %s\n", strerror(errno)); exit(1); @@ -1052,9 +1053,13 @@ static void pipeMode(void) { ssize_t nwritten = write(fd,obuf+obuf_pos,obuf_len); if (nwritten == -1) { - fprintf(stderr, "Error writing to the server: %s\n", - strerror(errno)); - exit(1); + if (errno != EAGAIN && errno != EINTR) { + fprintf(stderr, "Error writing to the server: %s\n", + strerror(errno)); + exit(1); + } else { + nwritten = 0; + } } obuf_len -= nwritten; obuf_pos += nwritten;