diff options
Diffstat (limited to 'src/tty-ask-password-agent')
-rw-r--r-- | src/tty-ask-password-agent/tty-ask-password-agent.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index ee66a3c312..5ee82c708b 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -6,7 +6,6 @@ #include <errno.h> #include <fcntl.h> #include <getopt.h> -#include <poll.h> #include <stdbool.h> #include <stddef.h> #include <sys/prctl.h> @@ -366,7 +365,7 @@ static int process_and_watch_password_files(bool watch) { } for (;;) { - int timeout = -1; + usec_t timeout = USEC_INFINITY; r = process_password_files(); if (r < 0) { @@ -385,16 +384,11 @@ static int process_and_watch_password_files(bool watch) { if (!watch) break; - if (poll(pollfd, _FD_MAX, timeout) < 0) { - if (errno == EINTR) - continue; - - return -errno; - } - - if (pollfd[FD_SIGNAL].revents & POLLNVAL || - pollfd[FD_INOTIFY].revents & POLLNVAL) - return -EBADF; + r = ppoll_usec(pollfd, _FD_MAX, timeout); + if (r == -EINTR) + continue; + if (r < 0) + return r; if (pollfd[FD_INOTIFY].revents != 0) (void) flush_fd(notify); |