]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/bus-unit-util: also send empty array for LogFilterPatterns=
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Jul 2025 10:07:13 +0000 (12:07 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 4 Jul 2025 10:14:27 +0000 (12:14 +0200)
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

index 9a4a8a865ae374cde2ea671f64a6dd3288a19847..e053cd31a610c4c50f40afc028836b6407dd30c3 100644 (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) {