[PATCH 1/7] virsh: Remove needless variable

Martin Kletzander posted 7 patches 4 years, 2 months ago
[PATCH 1/7] virsh: Remove needless variable
Posted by Martin Kletzander 4 years, 2 months ago
It only redundantly reflects whether pkagent != NULL.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
---
 tools/virsh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/virsh.c b/tools/virsh.c
index b9f3f851d3ec..da35c5c2b9c1 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++;
-- 
2.34.0

Re: [PATCH 1/7] virsh: Remove needless variable
Posted by Ján Tomko 4 years, 2 months ago
On a Sunday in 2021, Martin Kletzander wrote:
>It only redundantly reflects whether pkagent != NULL.
>
>Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
>---
> tools/virsh.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano