diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2014-10-30 12:01:51 +0100 |
---|---|---|
committer | Salvatore Sanfilippo <antirez@gmail.com> | 2014-10-30 12:01:51 +0100 |
commit | 2c42b645bcb412e447746619480d58b7cdc058e6 (patch) | |
tree | 15b87e1a900b27aa6cc53e1c766f63d036abc263 | |
parent | 6fbaeddf3f547217df9f808da80a716661bfa591 (diff) | |
parent | e10c5444e79f8f6ce24112175dd42afb8d0b067a (diff) | |
download | redis-2c42b645bcb412e447746619480d58b7cdc058e6.tar.gz |
Merge pull request #2078 from mattsta/hiredis-sigpipe
Fix redis-cli from exiting after idle connection breaks
-rw-r--r-- | src/redis-cli.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index 07bcf0a04..34070ab80 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; @@ -1914,6 +1915,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); |