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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2025-07-04 12:14:27 +02:00
parent 743b09c42c
commit 8d853534ed
+4 -9
View File
@@ -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) {