]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Check for pkttyagent availability properly
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 19 Nov 2021 16:12:54 +0000 (17:12 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 23 Nov 2021 11:51:09 +0000 (12:51 +0100)
It does not need a tty to work, it opens its controlling terminal for user
interaction and with this patch even crazy things like this work:

  echo 'list --name' | virsh -q >/dev/null

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virpolkit.c

index 201cf4a33fef9efcea38fefc5c64e5c9ca8a6bb7..8970de192fe1adaad5d91ad5320f41dc6f8bad3a 100644 (file)
@@ -180,9 +180,9 @@ virPolkitAgentCreate(void)
     int outfd = STDOUT_FILENO;
     int errfd = STDERR_FILENO;
 
-    if (!isatty(STDIN_FILENO)) {
+    if (!virPolkitAgentAvailable()) {
         virReportError(VIR_ERR_SYSTEM_ERROR, "%s",
-                       _("Cannot start polkit text agent without a tty"));
+                       _("polkit text authentication agent unavailable"));
         goto error;
     }