diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-03-02 20:11:45 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-03-03 21:06:48 +0100 |
commit | d9e2af0ae8b0fb4eff4a06447cde99002712dd3e (patch) | |
tree | 27565b953767b44f1ba4ec535ebed6c96738ef1e /src/tty-ask-password-agent | |
parent | io-util: introduce ppoll_usec() helper function (diff) | |
download | systemd-d9e2af0ae8b0fb4eff4a06447cde99002712dd3e.tar.xz systemd-d9e2af0ae8b0fb4eff4a06447cde99002712dd3e.zip |
tree-wide: use ppoll_usec()
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); |