[PATCH 2/2] virGetConnectGeneric: Only delegate existing identities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Inside virt-qemu-run, just like in virsh for example, there is no
identity set in the current thread, so we should not try to set it,
otherwise things like connecting to other drivers might fail and on
top of that there is no error set so the user can't even see what's
wrong.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2000075

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/driver.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/driver.c b/src/driver.c
index cea74bdf95c6..04cbbcd3ef83 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -160,17 +160,15 @@ virGetConnectGeneric(virThreadLocal *threadPtr, const char *name)
 
         if (conn->driver->connectSetIdentity != NULL) {
             g_autoptr(virIdentity) ident = NULL;
-            g_autoptr(virTypedParamList) identparams = NULL;
 
             VIR_DEBUG("Attempting to delegate current identity");
-            if (!(ident = virIdentityGetCurrent()))
-                goto error;
+            ident = virIdentityGetCurrent();
+            if (ident) {
+                g_autoptr(virTypedParamList) tmp = virIdentityGetParameters(ident);
 
-            if (!(identparams = virIdentityGetParameters(ident)))
-                goto error;
-
-            if (virConnectSetIdentity(conn, identparams->par, identparams->npar, 0) < 0)
-                goto error;
+                if (virConnectSetIdentity(conn, tmp->par, tmp->npar, 0) < 0)
+                    goto error;
+            }
         }
     }
     return conn;
-- 
2.38.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux