]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bus-unit-util: add helper for TimeoutSec=
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 27 Jun 2025 16:11:57 +0000 (18:11 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 3 Jul 2025 17:58:15 +0000 (19:58 +0200)
src/shared/bus-unit-util.c

index 70439f2df8864469ed8bf741a85701c8cfa55ab7..fd268782eb08a91121dc07a1d5815b300ab88277 100644 (file)
@@ -2228,6 +2228,16 @@ static int bus_append_timers_calendar(sd_bus_message *m, const char *field, cons
                                         "a(ss)", field, eq);
 }
 
+static int bus_append_timeout_sec(sd_bus_message *m, const char *field, const char *eq) {
+        int r;
+
+        r = bus_append_parse_sec_rename(m, "TimeoutStartSec", eq);
+        if (r < 0)
+                return r;
+
+        return bus_append_parse_sec_rename(m, "TimeoutStopSec", eq);
+}
+
 static int bus_try_append_condition(sd_bus_message *m, const char *field, const char *eq) {
         ConditionType t = condition_type_from_string(field);
         bool is_condition = t >= 0;
@@ -2703,8 +2713,6 @@ static int bus_append_scope_property(sd_bus_message *m, const char *field, const
 }
 
 static int bus_append_service_property(sd_bus_message *m, const char *field, const char *eq) {
-        int r;
-
         if (STR_IN_SET(field, "PIDFile",
                               "Type",
                               "ExitType",
@@ -2736,13 +2744,8 @@ static int bus_append_service_property(sd_bus_message *m, const char *field, con
                               "WatchdogSec"))
                 return bus_append_parse_sec_rename(m, field, eq);
 
-        if (streq(field, "TimeoutSec")) {
-                r = bus_append_parse_sec_rename(m, "TimeoutStartSec", eq);
-                if (r < 0)
-                        return r;
-
-                return bus_append_parse_sec_rename(m, "TimeoutStopSec", eq);
-        }
+        if (streq(field, "TimeoutSec"))
+                return bus_append_timeout_sec(m, field, eq);
 
         if (STR_IN_SET(field, "FileDescriptorStoreMax",
                               "RestartSteps"))