--- src/hostname/hostnamectl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c index 326f371..12ab8e2 100644 --- a/src/hostname/hostnamectl.c +++ b/src/hostname/hostnamectl.c @@ -67,6 +67,8 @@ typedef struct StatusInfo { char *pretty_hostname; char *icon_name; char *chassis; + char *os_name; + char *os_release; char *os_pretty_name; char *os_cpe_name; char *virtualization; @@ -76,7 +78,6 @@ typedef struct StatusInfo { static void print_status_info(StatusInfo *i) { sd_id128_t mid = {}, bid = {}; int r; - struct utsname u; assert(i); @@ -112,8 +113,8 @@ static void print_status_info(StatusInfo *i) { if (!isempty(i->os_cpe_name)) printf(" CPE OS Name: %s\n", i->os_cpe_name); - assert_se(uname(&u) >= 0); - printf(" Kernel: %s %s\n", u.sysname, u.release); + if (!isempty(i->os_name) && !isempty(i->os_release)) + printf(" Kernel: %s %s\n", i->os_name, i->os_release); if (!isempty(i->architecture)) printf(" Architecture: %s\n", i->architecture); @@ -156,6 +157,8 @@ static int show_all_names(sd_bus *bus) { { "PrettyHostname", "s", NULL, offsetof(StatusInfo, pretty_hostname) }, { "IconName", "s", NULL, offsetof(StatusInfo, icon_name) }, { "Chassis", "s", NULL, offsetof(StatusInfo, chassis) }, + { "OperatingSystemName", "s", NULL, offsetof(StatusInfo, os_name) }, + { "OperatingSystemRelease", "s", NULL, offsetof(StatusInfo, os_release) }, { "OperatingSystemPrettyName", "s", NULL, offsetof(StatusInfo, os_pretty_name) }, { "OperatingSystemCPEName", "s", NULL, offsetof(StatusInfo, os_cpe_name) }, {} @@ -191,6 +194,8 @@ fail: free(info.pretty_hostname); free(info.icon_name); free(info.chassis); + free(info.os_name); + free(info.os_release); free(info.os_pretty_name); free(info.os_cpe_name); free(info.virtualization); -- 1.8.5.3 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel