From: Martin Kletzander Date: Tue, 16 Nov 2021 13:30:07 +0000 (+0100) Subject: virsh: Remove needless variable X-Git-Tag: v7.10.0-rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e20ad737809c1bdfd491d7cc1d234cbe9a91e9eb;p=thirdparty%2Flibvirt.git virsh: Remove needless variable It only redundantly reflects whether pkagent != NULL. Signed-off-by: Martin Kletzander Reviewed-by: Ján Tomko --- diff --git a/tools/virsh.c b/tools/virsh.c index b9f3f851d3..da35c5c2b9 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -119,7 +119,6 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly) bool keepalive_forced = false; virPolkitAgent *pkagent = NULL; int authfail = 0; - bool agentCreated = false; if (ctl->keepalive_interval >= 0) { interval = ctl->keepalive_interval; @@ -141,12 +140,11 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly) goto cleanup; err = virGetLastError(); - if (!agentCreated && + if (!pkagent && err && err->domain == VIR_FROM_POLKIT && err->code == VIR_ERR_AUTH_UNAVAILABLE) { - if (!pkagent && !(pkagent = virPolkitAgentCreate())) + if (!(pkagent = virPolkitAgentCreate())) goto cleanup; - agentCreated = true; } else if (err && err->domain == VIR_FROM_POLKIT && err->code == VIR_ERR_AUTH_FAILED) { authfail++;