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