From: Martin Kletzander Date: Fri, 19 Nov 2021 15:20:25 +0000 (+0100) Subject: util: Report errors in all code paths in virPolkitAgentCreate X-Git-Tag: v7.10.0-rc1~43 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32eae6fd31ca610f3ba6e7476e79b3c464e25c68;p=thirdparty%2Flibvirt.git util: Report errors in all code paths in virPolkitAgentCreate Signed-off-by: Martin Kletzander Reviewed-by: Ján Tomko --- diff --git a/src/util/virpolkit.c b/src/util/virpolkit.c index ebe131dc51..201cf4a33f 100644 --- a/src/util/virpolkit.c +++ b/src/util/virpolkit.c @@ -180,8 +180,11 @@ virPolkitAgentCreate(void) int outfd = STDOUT_FILENO; int errfd = STDERR_FILENO; - if (!isatty(STDIN_FILENO)) + if (!isatty(STDIN_FILENO)) { + virReportError(VIR_ERR_SYSTEM_ERROR, "%s", + _("Cannot start polkit text agent without a tty")); goto error; + } if (virPipe(pipe_fd) < 0) goto error; @@ -205,8 +208,11 @@ virPolkitAgentCreate(void) pollfd.fd = pipe_fd[0]; pollfd.events = POLLHUP; - if (poll(&pollfd, 1, -1) < 0) + if (poll(&pollfd, 1, -1) < 0) { + virReportSystemError(errno, "%s", + _("error in poll call")); goto error; + } return agent;