diff options
-rw-r--r-- | src/hostname/hostnamed.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c index 48cbbdb04a..5c767cde97 100644 --- a/src/hostname/hostnamed.c +++ b/src/hostname/hostnamed.c @@ -43,6 +43,7 @@ enum { PROP_CHASSIS, PROP_KERNEL_NAME, PROP_KERNEL_RELEASE, + PROP_KERNEL_VERSION, PROP_OS_PRETTY_NAME, PROP_OS_CPE_NAME, _PROP_MAX @@ -82,7 +83,9 @@ static int context_read_data(Context *c) { assert_se(uname(&u) >= 0); c->data[PROP_KERNEL_NAME] = strdup(u.sysname); c->data[PROP_KERNEL_RELEASE] = strdup(u.release); - if (!c->data[PROP_KERNEL_NAME] || !c->data[PROP_KERNEL_RELEASE]) + c->data[PROP_KERNEL_VERSION] = strdup(u.version); + if (!c->data[PROP_KERNEL_NAME] || !c->data[PROP_KERNEL_RELEASE] || + !c->data[PROP_KERNEL_VERSION]) return -ENOMEM; c->data[PROP_HOSTNAME] = gethostname_malloc(); @@ -567,6 +570,7 @@ static const sd_bus_vtable hostname_vtable[] = { SD_BUS_PROPERTY("Chassis", "s", property_get_chassis, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_PROPERTY("KernelName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_KERNEL_NAME, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("KernelRelease", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_KERNEL_RELEASE, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("KernelVersion", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_KERNEL_VERSION, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("OperatingSystemPrettyName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_OS_PRETTY_NAME, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_PROPERTY("OperatingSystemCPEName", "s", NULL, offsetof(Context, data) + sizeof(char*) * PROP_OS_CPE_NAME, SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_METHOD("SetHostname", "sb", NULL, method_set_hostname, SD_BUS_VTABLE_UNPRIVILEGED), |