From d8d528e9926d712cf02617dcdb6e9bde90e4e49c Mon Sep 17 00:00:00 2001 From: antirez Date: Mon, 29 Nov 2010 12:20:17 +0100 Subject: [PATCH] quick and dirty fix for hiredis bug creating problem with the new redis-cli connect commmand. Also change prompt when redis-cli is not connected --- deps/hiredis/hiredis.c | 1 + src/redis-cli.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/deps/hiredis/hiredis.c b/deps/hiredis/hiredis.c index f0d78a0da..898b4d6af 100644 --- a/deps/hiredis/hiredis.c +++ b/deps/hiredis/hiredis.c @@ -664,6 +664,7 @@ void __redisSetError(redisContext *c, int type, const sds errstr) { static redisContext *redisContextInit() { redisContext *c = calloc(sizeof(redisContext),1); + c->fd = -1; /* quick fix for a bug that should be addressed differently */ c->err = 0; c->errstr = NULL; c->obuf = sdsempty(); diff --git a/src/redis-cli.c b/src/redis-cli.c index f59a1b851..09ab9189f 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -412,7 +412,7 @@ static void repl() { sds *argv; config.interactive = 1; - while((line = linenoise("redis> ")) != NULL) { + while((line = linenoise(context ? "redis> " : "not connected> ")) != NULL) { if (line[0] != '\0') { argv = sdssplitargs(line,&argc); linenoiseHistoryAdd(line);