1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-22 22:03:43 +03:00

systemctl: fix printing of RootImageOptions

The type is a(ss), so a custom printer is required.

Fixes https://github.com/systemd/systemd/issues/33967.

(cherry picked from commit 69c751c61cb2b386afe51f03b58f8f7ceeeb643e)
(cherry picked from commit 28ced52894cf6921d1fe9831f2def29de164e189)
(cherry picked from commit 64d833dfa6bcac6d4c991447bfd63d6bcda1ba6b)
(cherry picked from commit a28e7e93ea21cc8388e03aef6543c092e07550bd)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2024-09-27 20:17:12 +02:00 committed by Luca Boccassi
parent 9787154222
commit f4a7ec30a0

View File

@ -1671,6 +1671,29 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return bus_log_parse_error(r);
return 1;
} else if (streq(name, "RootImageOptions")) {
const char *a, *p;
/* In config files, the syntax allows the partition name to be omitted. Here, we
* always print the partition name, also because we have no way of knowing if it was
* originally omitted or not. We also print the partitions on separate lines. */
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(ss)");
if (r < 0)
return bus_log_parse_error(r);
while ((r = sd_bus_message_read(m, "(ss)", &a, &p)) > 0)
bus_print_property_valuef(name, expected_value, flags, "%s:%s", a, p);
if (r < 0)
return bus_log_parse_error(r);
r = sd_bus_message_exit_container(m);
if (r < 0)
return bus_log_parse_error(r);
return 1;
} else if (streq(name, "MountImages")) {
_cleanup_free_ char *paths = NULL;