mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-28 13:57:42 +03:00
util: Report errors in all code paths in virPolkitAgentCreate
Signed-off-by: Martin Kletzander <mkletzan@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0ac13b189f
commit
32eae6fd31
@ -180,8 +180,11 @@ virPolkitAgentCreate(void)
|
|||||||
int outfd = STDOUT_FILENO;
|
int outfd = STDOUT_FILENO;
|
||||||
int errfd = STDERR_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;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (virPipe(pipe_fd) < 0)
|
if (virPipe(pipe_fd) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -205,8 +208,11 @@ virPolkitAgentCreate(void)
|
|||||||
pollfd.fd = pipe_fd[0];
|
pollfd.fd = pipe_fd[0];
|
||||||
pollfd.events = POLLHUP;
|
pollfd.events = POLLHUP;
|
||||||
|
|
||||||
if (poll(&pollfd, 1, -1) < 0)
|
if (poll(&pollfd, 1, -1) < 0) {
|
||||||
|
virReportSystemError(errno, "%s",
|
||||||
|
_("error in poll call"));
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
return agent;
|
return agent;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user