From: Ján Tomko Date: Wed, 6 Apr 2016 08:08:55 +0000 (+0200) Subject: virsh: read default connection uri from env later X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c0726e0;p=libvirt.git virsh: read default connection uri from env later Postpone filling out the default connection in ctl->connname after calling virshInit. This allows printing help without a connection to the daemon. --- diff --git a/tools/virsh.c b/tools/virsh.c index 57b4ff3475..8c616d6373 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -968,9 +968,6 @@ main(int argc, char **argv) virFileActivateDirOverride(argv[0]); - if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"))) - ctl->connname = vshStrdup(ctl, defaultConn); - if (!vshInit(ctl, cmdGroups, NULL)) exit(EXIT_FAILURE); @@ -980,6 +977,9 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } + if ((defaultConn = virGetEnvBlockSUID("VIRSH_DEFAULT_CONNECT_URI"))) + ctl->connname = vshStrdup(ctl, defaultConn); + if (!ctl->imode) { ret = vshCommandRun(ctl, ctl->cmd); } else {