diff --git a/src/sentinel.c b/src/sentinel.c index c693a586..7d174ac2 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -2856,24 +2856,30 @@ numargserr: /* SENTINEL INFO [section] */ void sentinelInfoCommand(redisClient *c) { - char *section = c->argc == 2 ? c->argv[1]->ptr : "default"; - sds info = sdsempty(); - int defsections = !strcasecmp(section,"default"); - int sections = 0; - if (c->argc > 2) { addReply(c,shared.syntaxerr); return; } - if (!strcasecmp(section,"server") || defsections) { + int defsections = 0, allsections = 0; + char *section = c->argc == 2 ? c->argv[1]->ptr : NULL; + if (section) { + allsections = !strcasecmp(section,"all"); + defsections = !strcasecmp(section,"default"); + } else { + defsections = 1; + } + + int sections = 0; + sds info = sdsempty(); + if (defsections || allsections || !strcasecmp(section,"server")) { if (sections++) info = sdscat(info,"\r\n"); sds serversection = genRedisInfoString("server"); info = sdscatlen(info,serversection,sdslen(serversection)); sdsfree(serversection); } - if (!strcasecmp(section,"sentinel") || defsections) { + if (defsections || allsections || !strcasecmp(section,"sentinel")) { dictIterator *di; dictEntry *de; int master_id = 0;