virsh: re-fix help printing without connection

Re-do 0217089 so it does not add regression for commit c0726e0 that allowed to
print help without making a connection to the daemon.
This commit is contained in:
Roman Bogorodskiy 2016-04-21 11:26:31 +03:00
parent ed5c929777
commit 384dde557b

View File

@ -962,14 +962,16 @@ main(int argc, char **argv)
if (!vshInit(ctl, cmdGroups, NULL))
exit(EXIT_FAILURE);
ctl->connname = vshStrdup(ctl, virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"));
if (!virshParseArgv(ctl, argc, argv) ||
!virshInit(ctl)) {
virshDeinit(ctl);
exit(EXIT_FAILURE);
}
if (!ctl->connname)
ctl->connname = vshStrdup(ctl,
virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"));
if (!ctl->imode) {
ret = vshCommandRun(ctl, ctl->cmd);
} else {