From: Zbigniew Jędrzejewski-Szmek Date: Fri, 27 Jun 2025 14:05:33 +0000 (+0200) Subject: shared/bus-unit-util: define helper for Paths property X-Git-Tag: v258-rc1~183^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a5eb9d03de6be39bab15e9ddfca7ff9d7d90df3;p=thirdparty%2Fsystemd.git shared/bus-unit-util: define helper for Paths property --- diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index c7fce7e77fe..0fdf946f97e 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -2069,6 +2069,19 @@ static int bus_append_protect_hostname(sd_bus_message *m, const char *field, con return 1; } +static int bus_append_paths(sd_bus_message *m, const char *field, const char *eq) { + int r; + + if (isempty(eq)) + r = sd_bus_message_append(m, "(sv)", "Paths", "a(ss)", 0); + else + r = sd_bus_message_append(m, "(sv)", "Paths", "a(ss)", 1, field, eq); + if (r < 0) + return bus_log_create_error(r); + + return 1; +} + static int bus_append_cgroup_property(sd_bus_message *m, const char *field, const char *eq) { if (STR_IN_SET(field, "DevicePolicy", "Slice", @@ -2492,16 +2505,8 @@ static int bus_append_path_property(sd_bus_message *m, const char *field, const "PathExistsGlob", "PathChanged", "PathModified", - "DirectoryNotEmpty")) { - if (isempty(eq)) - r = sd_bus_message_append(m, "(sv)", "Paths", "a(ss)", 0); - else - r = sd_bus_message_append(m, "(sv)", "Paths", "a(ss)", 1, field, eq); - if (r < 0) - return bus_log_create_error(r); - - return 1; - } + "DirectoryNotEmpty")) + return bus_append_paths(m, field, eq); if (STR_IN_SET(field, "TriggerLimitBurst", "PollLimitBurst")) return bus_append_safe_atou(m, field, eq);