From 8d853534edb186b079030adb5f3c602ef58fee41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 4 Jul 2025 12:07:13 +0200 Subject: [PATCH] shared/bus-unit-util: also send empty array for LogFilterPatterns= Before, for empty input, we'd send an array with one item with an empty pattern. Use the helper which sends an empty array instead. bus_exec_context_set_transient_property() ignores items with an empty pattern, so the result should be the same. Request in review: https://github.com/systemd/systemd/pull/37665#discussion_r2182375988. --- src/shared/bus-unit-util.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 9a4a8a865a..e053cd31a6 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -1223,15 +1223,10 @@ static int bus_append_log_extra_fields(sd_bus_message *m, const char *field, con } static int bus_append_log_filter_patterns(sd_bus_message *m, const char *field, const char *eq) { - int r; - - r = sd_bus_message_append(m, "(sv)", "LogFilterPatterns", "a(bs)", 1, - eq[0] != '~', - eq[0] != '~' ? eq : eq + 1); - if (r < 0) - return bus_log_create_error(r); - - return 1; + return bus_append_trivial_array(m, field, eq, + "a(bs)", + eq[0] != '~', + eq[0] != '~' ? eq : eq + 1); } static int bus_append_standard_inputs(sd_bus_message *m, const char *field, const char *eq) {