From: Erik Skultety Date: Mon, 19 Sep 2016 11:10:38 +0000 (+0200) Subject: vsh: Enforce checking for missing help string X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ebb402a7c4d41610018610678e7d9d7df95257c0;p=libvirt.git vsh: Enforce checking for missing help string The intention is to move vshCmddefCheckInternals out of vshCmddefOptParse to our test suite. First step to do that is to enforce checking for an existing help string (that also means it's non-empty) in a command because a command without a help is not much of a use. Signed-off-by: Erik Skultety --- diff --git a/tools/vsh.c b/tools/vsh.c index 4ee472c3a1..f3b3fca61a 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -328,6 +328,11 @@ static int vshCmddefCheckInternals(const vshCmdDef *cmd) { size_t i; + const char *help = NULL; + + /* Each command has to provide a non-empty help string. */ + if (!(help = vshCmddefGetInfo(cmd, "help")) || !*help) + return -1; if (!cmd->opts) return 0;