diff options
author | Lennart Poettering <lennart@poettering.net> | 2024-03-01 14:47:52 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2024-03-01 22:37:38 +0100 |
commit | 8157cc0e3e33c97b406cc088cf001ca524154f64 (patch) | |
tree | f96a2f484bda2d21e25e085fed48a0d96681a5cc /src/machine | |
parent | test74: create ssh empty dir all at the same place (diff) | |
download | systemd-8157cc0e3e33c97b406cc088cf001ca524154f64.tar.xz systemd-8157cc0e3e33c97b406cc088cf001ca524154f64.zip |
bus-util: add generic parser for extracting id128 values from bus messages
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machinectl.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index a7d04f2f4d..b93c73f3cd 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -767,22 +767,17 @@ static int print_image_hostname(sd_bus *bus, const char *name) { static int print_image_machine_id(sd_bus *bus, const char *name) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL; - sd_id128_t id = SD_ID128_NULL; - const void *p; - size_t size; + sd_id128_t id; int r; r = bus_call_method(bus, bus_machine_mgr, "GetImageMachineID", NULL, &reply, "s", name); if (r < 0) return r; - r = sd_bus_message_read_array(reply, 'y', &p, &size); + r = bus_message_read_id128(reply, &id); if (r < 0) return r; - if (size == sizeof(sd_id128_t)) - memcpy(&id, p, size); - if (!sd_id128_is_null(id)) printf(" Machine ID: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(id)); |