]> xenbits.xensource.com Git - libvirt.git/commitdiff
vsh: Cmd aliases lookups should return results for the aliased command
authorErik Skultety <eskultet@redhat.com>
Thu, 25 Jan 2018 15:13:37 +0000 (16:13 +0100)
committerErik Skultety <eskultet@redhat.com>
Thu, 25 Jan 2018 15:20:27 +0000 (16:20 +0100)
Unfortunately, we have a number of aliases in virsh and even though
these are not visible any more, we have to support them. The problem is
that when trying to print help for the alias, we get SIGSEGV because
there isn't any @def structure anymore and we need to query the command
being aliased instead.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1538570

Signed-off-by: Erik Skultety <eskultet@redhat.com>
tools/vsh.c

index 761d2ec3a44743a8d2f6a5200b16352777796391..37c292a03ddbd41bb2b60acc45187f9057c100cd 100644 (file)
@@ -3194,6 +3194,8 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd)
     }
 
     if ((def = vshCmddefSearch(name))) {
+        if (def->flags & VSH_CMD_FLAG_ALIAS)
+            def = vshCmddefSearch(def->alias);
         return vshCmddefHelp(ctl, def);
     } else if ((grp = vshCmdGrpSearch(name))) {
         return vshCmdGrpHelp(ctl, grp);