summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Stancliff <matt@genges.com>2014-10-17 08:21:16 -0500
committerantirez <antirez@gmail.com>2014-10-30 12:02:32 +0100
commiteb67ca0f002062c9b7b03db2b92ddb594c5b7027 (patch)
treea8e6891e606bb9d6f110cbe3a819f1ee5de8bd50
parentbb9ad32cb0a28b45d6fa252599beb0714dc156ea (diff)
downloadredis-eb67ca0f002062c9b7b03db2b92ddb594c5b7027.tar.gz
redis-cli: ignore SIGPIPE network errors
Closes #2066
-rw-r--r--src/redis-cli.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index cea4ebc1e..3a53dbe8f 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -524,7 +524,8 @@ static int cliReadReply(int output_raw_strings) {
}
if (config.interactive) {
/* Filter cases where we should reconnect */
- if (context->err == REDIS_ERR_IO && errno == ECONNRESET)
+ if (context->err == REDIS_ERR_IO &&
+ (errno == ECONNRESET || errno == EPIPE))
return REDIS_ERR;
if (context->err == REDIS_ERR_EOF)
return REDIS_ERR;
@@ -1913,6 +1914,8 @@ int main(int argc, char **argv) {
argc -= firstarg;
argv += firstarg;
+ signal(SIGPIPE, SIG_IGN);
+
/* Latency mode */
if (config.latency_mode) {
if (cliConnect(0) == REDIS_ERR) exit(1);