render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From 86fe847f4d6e06c926e98b108063685bdbf332ee Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <86fe847f4d6e06c926e98b108063685bdbf332ee@dist-git>
6ae9ed
From: Erik Skultety <eskultet@redhat.com>
6ae9ed
Date: Wed, 10 Aug 2016 15:33:12 +0200
6ae9ed
Subject: [PATCH] virt-admin: Fix the error when an invalid URI has been
6ae9ed
 provided
6ae9ed
6ae9ed
After commit 9d479dd1 fiddled with the cmdConnect's output which used to be a
6ae9ed
bit more verbose prior to the mentioned commit, the program flow would result
6ae9ed
in a quite confusing error if an invalid URI has been provided:
6ae9ed
6ae9ed
    error: Failed to connect to the admin server
6ae9ed
    Connected to the admin server
6ae9ed
    error: <some error>
6ae9ed
6ae9ed
The problem is that the commit mentioned above relied on the fact that
6ae9ed
connect routine always succeeds which is not true.
6ae9ed
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
(cherry picked from commit 4914494eb8e25ff7938a12fd089c746ec6042bbb)
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1365903
6ae9ed
Signed-off-by: Erik Skultety <eskultet@redhat.com>
6ae9ed
---
6ae9ed
 tools/virt-admin.c | 2 +-
6ae9ed
 1 file changed, 1 insertion(+), 1 deletion(-)
6ae9ed
6ae9ed
diff --git a/tools/virt-admin.c b/tools/virt-admin.c
6ae9ed
index 2ae05da..513054b 100644
6ae9ed
--- a/tools/virt-admin.c
6ae9ed
+++ b/tools/virt-admin.c
6ae9ed
@@ -351,7 +351,7 @@ cmdConnect(vshControl *ctl, const vshCmd *cmd)
6ae9ed
     }
6ae9ed
 
6ae9ed
     vshAdmReconnect(ctl);
6ae9ed
-    if (!connected)
6ae9ed
+    if (!connected && priv->conn)
6ae9ed
         vshPrint(ctl, "%s\n", _("Connected to the admin server"));
6ae9ed
 
6ae9ed
     return !!priv->conn;
6ae9ed
-- 
6ae9ed
2.9.2
6ae9ed