From 0154edc96f6bef1a78f53c45735805983b7b1828 Mon Sep 17 00:00:00 2001 From: William Lallemand Date: Tue, 15 May 2018 11:50:04 +0200 Subject: [PATCH] BUG/MINOR: cli: don't stop cli_gen_usage_msg() when kw->usage == NULL In commit abbf607 ("MEDIUM: cli: Add payload support") some cli keywords without usage message have been added at the beginning of the keywords array. cli_gen_usage_usage_msg() use the kw->usage == NULL to stop generating the usage message for the current keywords array. With those keywords at the beginning, the whole array in cli.c was ignored in the usage message generation. This patch now checks the keyword itself, allowing a keyword without usage message anywhere in the array. --- src/cli.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cli.c b/src/cli.c index 38d715f83..4adf68401 100644 --- a/src/cli.c +++ b/src/cli.c @@ -109,8 +109,9 @@ static char *cli_gen_usage_msg(struct appctx *appctx) chunk_strcat(tmp, stats_sock_usage_msg); list_for_each_entry(kw_list, &cli_keywords.list, list) { kw = &kw_list->kw[0]; - while (kw->usage) { - chunk_appendf(tmp, " %s\n", kw->usage); + while (kw->str_kw[0]) { + if (kw->usage) + chunk_appendf(tmp, " %s\n", kw->usage); kw++; } }