From: Zbigniew Jędrzejewski-Szmek Date: Fri, 27 Jun 2025 11:44:09 +0000 (+0200) Subject: shared/bus-unit-util: define helper for Delegate= X-Git-Tag: v258-rc1~183^2~57 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3704d0ad1b575058a797d2d1bd6a4735567871f2;p=thirdparty%2Fsystemd.git shared/bus-unit-util: define helper for Delegate= --- diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index a9c9a0138c9..de6413135c1 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -300,6 +300,20 @@ static int bus_append_parse_cpu_set(sd_bus_message *m, const char *field, const return bus_append_byte_array(m, field, array, allocated); } +static int bus_append_parse_delegate(sd_bus_message *m, const char *field, const char *eq) { + int r; + + r = parse_boolean(eq); + if (r < 0) + return bus_append_strv(m, "DelegateControllers", eq, /* separator= */ NULL, EXTRACT_UNQUOTE); + + r = sd_bus_message_append(m, "(sv)", "Delegate", "b", r); + if (r < 0) + return bus_log_create_error(r); + + return 1; +} + static int bus_append_exec_command(sd_bus_message *m, const char *field, const char *eq) { bool explicit_path = false, done = false, ambient_hack = false; _cleanup_strv_free_ char **l = NULL, **ex_opts = NULL; @@ -640,19 +654,10 @@ static int bus_append_cgroup_property(sd_bus_message *m, const char *field, cons return bus_append_parse_cpu_set(m, field, eq); if (streq(field, "DisableControllers")) - return bus_append_strv(m, "DisableControllers", eq, /* separator= */ NULL, EXTRACT_UNQUOTE); - - if (streq(field, "Delegate")) { - r = parse_boolean(eq); - if (r < 0) - return bus_append_strv(m, "DelegateControllers", eq, /* separator= */ NULL, EXTRACT_UNQUOTE); - - r = sd_bus_message_append(m, "(sv)", "Delegate", "b", r); - if (r < 0) - return bus_log_create_error(r); + return bus_append_strv(m, field, eq, /* separator= */ NULL, EXTRACT_UNQUOTE); - return 1; - } + if (streq(field, "Delegate")) + return bus_append_parse_delegate(m, field, eq); if (STR_IN_SET(field, "MemoryMin", "DefaultMemoryLow",