From: antirez Date: Mon, 29 Nov 2010 11:20:17 +0000 (+0100) Subject: quick and dirty fix for hiredis bug creating problem with the new redis-cli connect... X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/d8d528e9926d712cf02617dcdb6e9bde90e4e49c?ds=inline;hp=-c 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 --- d8d528e9926d712cf02617dcdb6e9bde90e4e49c diff --git a/deps/hiredis/hiredis.c b/deps/hiredis/hiredis.c index f0d78a0d..898b4d6a 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 f59a1b85..09ab9189 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);