]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh: re-fix help printing without connection
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 21 Apr 2016 08:26:31 +0000 (11:26 +0300)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 21 Apr 2016 10:28:57 +0000 (13:28 +0300)
Re-do 0217089 so it does not add regression for commit c0726e0 that allowed to
print help without making a connection to the daemon.

tools/virsh.c

index e14410bd5cfd8b71beba60f402974d684368316c..366956cd5c75fc722899e4621d0df7d28d5da63a 100644 (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 {