summaryrefslogtreecommitdiff
path: root/src/tty-ask-password-agent
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-03-03 04:11:45 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-03-04 05:06:48 +0900
commitd9e2af0ae8b0fb4eff4a06447cde99002712dd3e (patch)
tree27565b953767b44f1ba4ec535ebed6c96738ef1e /src/tty-ask-password-agent
parentc4febde9d0f2faf13aff3a5285c8fdff22073dc6 (diff)
downloadsystemd-d9e2af0ae8b0fb4eff4a06447cde99002712dd3e.tar.gz
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.c18
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);