chiark / gitweb /
resolve: update sd-resolve to match the other APIs in style and functionality
[elogind.git] / src / shared / util.c
index 5551714a366de924978cc72762491d7eedbafdc0..cdd9a48866b16797e698cd4e594d7534e31f7568 100644 (file)
@@ -3869,13 +3869,16 @@ int pipe_eof(int fd) {
 }
 
 int fd_wait_for_event(int fd, int event, usec_t t) {
-        int r;
+
         struct pollfd pollfd = {
                 .fd = fd,
                 .events = event,
         };
 
-        r = poll(&pollfd, 1, t == (usec_t) -1 ? -1 : (int) (t / USEC_PER_MSEC));
+        struct timespec ts;
+        int r;
+
+        r = ppoll(&pollfd, 1, t == (usec_t) -1 ? NULL : timespec_store(&ts, t), NULL);
         if (r < 0)
                 return -errno;