From 6d12f1b7876db48c591383d042e564cf0731095e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 5 Mar 2021 17:53:34 +0100 Subject: [PATCH] network-wait-online: use sd_event_add_time_relative() --- src/network/wait-online/manager.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/network/wait-online/manager.c b/src/network/wait-online/manager.c index 9710742123..1438b27445 100644 --- a/src/network/wait-online/manager.c +++ b/src/network/wait-online/manager.c @@ -323,12 +323,8 @@ int manager_new(Manager **ret, Hashmap *interfaces, char **ignore, (void) sd_event_add_signal(m->event, NULL, SIGINT, NULL, NULL); if (timeout > 0) { - usec_t usec; - - usec = usec_add(now(clock_boottime_or_monotonic()), timeout); - - r = sd_event_add_time(m->event, NULL, clock_boottime_or_monotonic(), usec, 0, NULL, INT_TO_PTR(-ETIMEDOUT)); - if (r < 0) + r = sd_event_add_time_relative(m->event, NULL, clock_boottime_or_monotonic(), timeout, 0, NULL, INT_TO_PTR(-ETIMEDOUT)); + if (r < 0 && r != -EOVERFLOW) return r; }