From 00c0ba5de36105253f5fc047325524687b43f8dd Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Fri, 19 Nov 2021 17:12:54 +0100 Subject: [PATCH] util: Check for pkttyagent availability properly MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Ján Tomko --- src/util/virpolkit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index 201cf4a33f..8970de192f 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -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; } -- 2.47.2