From b77e4fc6cebc819ee33a86cd47679115cad14881 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 27 Jun 2025 18:11:57 +0200 Subject: [PATCH] shared/bus-unit-util: add helper for TimeoutSec= --- src/shared/bus-unit-util.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 70439f2df88..fd268782eb0 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -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")) -- 2.47.3