]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network-wait-online: use sd_event_add_time_relative()
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 Mar 2021 16:53:34 +0000 (17:53 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 5 Mar 2021 18:27:23 +0000 (19:27 +0100)
src/network/wait-online/manager.c

index 97107421239a1eac98583f478efda72b9d879798..1438b27445c898ea3d8550dcfefc326322b2912b 100644 (file)
@@ -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;
         }