diff --git a/tools/virsh.c b/tools/virsh.c index d3fe06f190324a0b8044dc88990e5b9900307590..cb60edcfc9dfdadf0f9edb462617ed1a2a7c22a4 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -168,7 +168,7 @@ virshConnect(vshControl *ctl, const char *uri, bool readonly) err = virGetLastError(); if (err && err->domain == VIR_FROM_POLKIT && err->code == VIR_ERR_AUTH_UNAVAILABLE) { - if (!(pkagent = virPolkitAgentCreate())) + if (!pkagent && !(pkagent = virPolkitAgentCreate())) goto cleanup; } else if (err && err->domain == VIR_FROM_POLKIT && err->code == VIR_ERR_AUTH_FAILED) {