]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: Report errors in all code paths in virPolkitAgentCreate
authorMartin Kletzander <mkletzan@redhat.com>
Fri, 19 Nov 2021 15:20:25 +0000 (16:20 +0100)
committerMartin Kletzander <mkletzan@redhat.com>
Tue, 23 Nov 2021 11:51:09 +0000 (12:51 +0100)
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virpolkit.c

index ebe131dc51df7ac5eba6a07c0b19ade2b15244eb..201cf4a33fef9efcea38fefc5c64e5c9ca8a6bb7 100644 (file)
@@ -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;