]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: use DIV_ROUND_UP where appropriate
authorLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 12:52:17 +0000 (14:52 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Apr 2019 12:54:42 +0000 (14:54 +0200)
src/libsystemd/sd-event/sd-event.c

index eb98e49ca210b2aa3e36e6b6f4be233d90efb9d8..1987f279eb3f733c64ef6f7347fe7a7c3855bfea 100644 (file)
@@ -3116,7 +3116,7 @@ _public_ int sd_event_wait(sd_event *e, uint64_t timeout) {
                 timeout = 0;
 
         m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
                 timeout = 0;
 
         m = epoll_wait(e->epoll_fd, ev_queue, ev_queue_max,
-                       timeout == (uint64_t) -1 ? -1 : (int) ((timeout + USEC_PER_MSEC - 1) / USEC_PER_MSEC));
+                       timeout == (uint64_t) -1 ? -1 : (int) DIV_ROUND_UP(timeout, USEC_PER_MSEC));
         if (m < 0) {
                 if (errno == EINTR) {
                         e->state = SD_EVENT_PENDING;
         if (m < 0) {
                 if (errno == EINTR) {
                         e->state = SD_EVENT_PENDING;