machinectl fails when virtual machine is running (#1419501)

Resolves: #1419501
This commit is contained in:
Jan Synacek 2017-02-14 11:58:55 +01:00
parent f020f8b986
commit 78d35a9ba2
2 changed files with 56 additions and 2 deletions

View File

@ -0,0 +1,50 @@
From bd99ada53a580dd28bc2c6bfcd2c974e0696ed94 Mon Sep 17 00:00:00 2001
From: Jan Synacek <jsynacek@redhat.com>
Date: Tue, 14 Feb 2017 10:21:53 +0100
Subject: [PATCH] machinectl: make sure that inability to get OS version isn't
consider fatal for machine list
Backported from: 4b2419165ce409ee55ce96a926302f89685f2293
Resolves: #1419501
---
src/machine/machinectl.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index 7b9be3b..7fe1da1 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -242,24 +242,20 @@ static int list_machines(int argc, char *argv[], void *userdata) {
if (name[0] == '.' && !arg_all)
continue;
- if (!GREEDY_REALLOC(machines, n_allocated, n_machines + 1)) {
+ if (!GREEDY_REALLOC0(machines, n_allocated, n_machines + 1)) {
r = log_oom();
goto out;
}
- machines[n_machines].os = NULL;
- machines[n_machines].version_id = NULL;
- r = get_os_release_property(bus, name,
- "ID\0" "VERSION_ID\0",
- &machines[n_machines].os,
- &machines[n_machines].version_id);
- if (r < 0)
- goto out;
-
machines[n_machines].name = name;
machines[n_machines].class = class;
machines[n_machines].service = service;
+ (void) get_os_release_property(bus, name,
+ "ID\0" "VERSION_ID\0",
+ &machines[n_machines].os,
+ &machines[n_machines].version_id);
+
l = strlen(name);
if (l > max_name)
max_name = l;
--
2.9.3

View File

@ -12,7 +12,7 @@
Name: systemd Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 232 Version: 232
Release: 13%{?gitcommit:.git%{gitcommitshort}}%{?dist} Release: 14%{?gitcommit:.git%{gitcommitshort}}%{?dist}
# For a breakdown of the licensing, see README # For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+ License: LGPLv2+ and MIT and GPLv2+
Summary: System and Service Manager Summary: System and Service Manager
@ -102,6 +102,7 @@ Patch0057: 0057-systemctl-always-avoid-being-killed-when-doing-switc.patch
Patch0058: 0058-systemctl-ignore-SIGTERM-after-switch-root.patch Patch0058: 0058-systemctl-ignore-SIGTERM-after-switch-root.patch
Patch0059: 0059-units-restore-Before-dependencies-for-systemd-vconso.patch Patch0059: 0059-units-restore-Before-dependencies-for-systemd-vconso.patch
Patch0060: 0060-coredump-really-extract-container-cmdline-5167.patch Patch0060: 0060-coredump-really-extract-container-cmdline-5167.patch
Patch0061: 0061-machinectl-make-sure-that-inability-to-get-OS-versio.patch
# GIT_DIR=../../src/systemd/.git git diffab -M v232..master@{2017-01-30} hwdb/[67]* > hwdb.patch # GIT_DIR=../../src/systemd/.git git diffab -M v232..master@{2017-01-30} hwdb/[67]* > hwdb.patch
Patch0997: hwdb.patch Patch0997: hwdb.patch
@ -1025,7 +1026,10 @@ getent passwd systemd-journal-upload &>/dev/null || useradd -r -l -g systemd-jou
%{_mandir}/man[1578]/systemd-journal-gateway* %{_mandir}/man[1578]/systemd-journal-gateway*
%changelog %changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> * Tue Feb 14 2017 Jan Synáček <jsynacek@redhat.com> - 232-14
- machinectl fails when virtual machine is running (#1419501)
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 232-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 31 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 232-12 * Tue Jan 31 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 232-12