summaryrefslogtreecommitdiff
path: root/src/hostname
diff options
context:
space:
mode:
Diffstat (limited to 'src/hostname')
-rw-r--r--src/hostname/hostnamectl.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c
index 8d8dc3d7f3..cc7db67d79 100644
--- a/src/hostname/hostnamectl.c
+++ b/src/hostname/hostnamectl.c
@@ -142,12 +142,12 @@ static int show_one_name(sd_bus *bus, const char* attr) {
static int show_all_names(sd_bus *bus) {
StatusInfo info = {};
- const struct bus_properties_map map[] = {
- { "s", "Hostname", &info.hostname },
- { "s", "StaticHostname", &info.static_hostname },
- { "s", "PrettyHostname", &info.pretty_hostname },
- { "s", "IconName", &info.icon_name },
- { "s", "Chassis", &info.chassis },
+ static const struct bus_properties_map map[] = {
+ { "Hostname", "s", NULL, offsetof(StatusInfo, hostname) },
+ { "StaticHostname", "s", NULL, offsetof(StatusInfo, static_hostname) },
+ { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) },
+ { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) },
+ { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) },
{}
};
int r;
@@ -155,7 +155,8 @@ static int show_all_names(sd_bus *bus) {
r = bus_map_all_properties(bus,
"org.freedesktop.hostname1",
"/org/freedesktop/hostname1",
- map);
+ map,
+ &info);
if (r < 0)
goto fail;