From: Peter Krempa Date: Thu, 14 Dec 2023 16:11:08 +0000 (+0100) Subject: virshReconnect: Preserve current URI if not explicitly set in ctl->connname X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=06f6d76334af6baff0685839a4f39979f259a81f;p=people%2Faperard%2Flibvirt.git virshReconnect: Preserve current URI if not explicitly set in ctl->connname Probe the current URI so that other places don't need to do that. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/tools/virsh.c b/tools/virsh.c index 7b71131db3..18a8c32f53 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -225,6 +225,9 @@ virshReconnect(vshControl *ctl, const char *name, bool readonly, bool force) ctl->connname = g_strdup(name); } + if (!ctl->connname) + ctl->connname = virConnectGetURI(priv->conn); + priv->readonly = readonly; if (virConnectRegisterCloseCallback(priv->conn, virshCatchDisconnect,