diff options
Diffstat (limited to 'src/libsystemd/sd-bus/sd-bus.c')
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 6b1f25cc02..d593002712 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -2,7 +2,6 @@ #include <endian.h> #include <netdb.h> -#include <poll.h> #include <pthread.h> #include <signal.h> #include <stdlib.h> @@ -32,6 +31,7 @@ #include "fd-util.h" #include "hexdecoct.h" #include "hostname-util.h" +#include "io-util.h" #include "macro.h" #include "memory-util.h" #include "missing_syscall.h" @@ -3255,9 +3255,8 @@ _public_ int sd_bus_process_priority(sd_bus *bus, int64_t priority, sd_bus_messa static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) { struct pollfd p[2] = {}; - int r, n; - struct timespec ts; usec_t m = USEC_INFINITY; + int r, n; assert(bus); @@ -3312,16 +3311,9 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) { if (timeout_usec != (uint64_t) -1 && (m == USEC_INFINITY || timeout_usec < m)) m = timeout_usec; - r = ppoll(p, n, m == USEC_INFINITY ? NULL : timespec_store(&ts, m), NULL); - if (r < 0) - return -errno; - if (r == 0) - return 0; - - if (p[0].revents & POLLNVAL) - return -EBADF; - if (n >= 2 && (p[1].revents & POLLNVAL)) - return -EBADF; + r = ppoll_usec(p, n, m); + if (r <= 0) + return r; return 1; } |