diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-09-18 01:28:23 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-09-18 01:29:49 +0900 |
commit | f6e8ba816577a1a26037a8aeae23fda36d74f0ac (patch) | |
tree | 27c6dfdf75b50b4ed0750a0e038f443ad23265bf | |
parent | 2f5b282aab78bd2378df428c57c5fd1cc09e9f4f (diff) | |
download | systemd-f6e8ba816577a1a26037a8aeae23fda36d74f0ac.tar.gz |
udevadm: use usec_add()
Also fixes description of event source.
-rw-r--r-- | src/udev/udev-ctrl.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index 751e034982..f1befc7304 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -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); |