]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udevadm: use usec_add()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Sep 2019 16:28:23 +0000 (01:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Sep 2019 16:29:49 +0000 (01:29 +0900)
Also fixes description of event source.

src/udev/udev-ctrl.c

index 751e03498233c4507bc34953f6461610798b882e..f1befc73043d5d97b5bdaba9fa97a5bf1a1a09a8 100644 (file)
@@ -395,14 +395,13 @@ int udev_ctrl_wait(struct udev_ctrl *uctrl, usec_t timeout) {
         (void) sd_event_source_set_description(source_io, "udev-ctrl-wait-io");
 
         if (timeout != USEC_INFINITY) {
-                usec_t usec;
-
-                usec = now(clock_boottime_or_monotonic()) + timeout;
-                r = sd_event_add_time(uctrl->event, &source_timeout, clock_boottime_or_monotonic(), usec, 0, NULL, INT_TO_PTR(-ETIMEDOUT));
+                r = sd_event_add_time(uctrl->event, &source_timeout, clock_boottime_or_monotonic(),
+                                      usec_add(now(clock_boottime_or_monotonic()), timeout),
+                                      0, NULL, INT_TO_PTR(-ETIMEDOUT));
                 if (r < 0)
                         return r;
 
-                (void) sd_event_source_set_description(source_timeout, "udev-ctrl-wait-io");
+                (void) sd_event_source_set_description(source_timeout, "udev-ctrl-wait-timeout");
         }
 
         return sd_event_loop(uctrl->event);