From c0726e0708762e571a7883cb0558cfec32459669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Wed, 6 Apr 2016 10:08:55 +0200 Subject: [PATCH] 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. --- tools/virsh.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 {