summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDjalal Harouni <tixxdz@opendz.org>2014-04-23 23:03:34 +0100
committerLennart Poettering <lennart@poettering.net>2014-05-19 01:46:52 +0900
commit9be3455f55a5aa445ae8ae69301c54d19111d2e4 (patch)
tree3b2769456d15dd03890e26e150a362f8ac52abf6
parent2a4d1ec1520c926b0160efe14142634e164ddc30 (diff)
hostnamed: expose KernelVersion on the bus
This is needed to fix bug: https://bugs.freedesktop.org/show_bug.cgi?id=76498 Reported-by: Zach <zachcook1991@gmail.com>
-rw-r--r--src/hostname/hostnamed.c6
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),