]> xenbits.xensource.com Git - libvirt.git/commitdiff
virt-admin: Fix the error when an invalid URI has been provided
authorErik Skultety <eskultet@redhat.com>
Tue, 9 Aug 2016 14:11:26 +0000 (16:11 +0200)
committerErik Skultety <eskultet@redhat.com>
Wed, 10 Aug 2016 13:24:07 +0000 (15:24 +0200)
After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
bit more verbose prior to the mentioned commit, the program flow would result
in a quite confusing error if an invalid URI has been provided:

    error: Failed to connect to the admin server
    Connected to the admin server
    error: <some error>

The problem is that the commit mentioned above relied on the fact that
connect routine always succeeds which is not true.

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

index 2ae05dab722e5ec9661fc173e98cb7952584b601..513054b38b9951a44cc4a55552e77ce4b6ec9ce8 100644 (file)
@@ -351,7 +351,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
     }
 
     vshAdmReconnect(ctl);
-    if (!connected)
+    if (!connected && priv->conn)
         vshPrint(ctl, "%s\n", _("Connected to the admin server"));
 
     return !!priv->conn;