]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machinectl: make sure that inability to get OS version isn't consider fatal for machi...
authorLennart Poettering <lennart@poettering.net>
Thu, 29 Dec 2016 11:09:54 +0000 (12:09 +0100)
committerMartin Pitt <martin.pitt@ubuntu.com>
Thu, 29 Dec 2016 11:09:54 +0000 (12:09 +0100)
Fixes: #4918
src/machine/machinectl.c

index f85ef5b6ec125680f399a1103750781e9d7d7eb8..462667cf37e5086196dab2fd643c5854f8b5220f 100644 (file)
@@ -243,14 +243,16 @@ 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 = call_get_os_release(
+                machines[n_machines].name = name;
+                machines[n_machines].class = class;
+                machines[n_machines].service = service;
+
+                (void) call_get_os_release(
                                 bus,
                                 "GetMachineOSRelease",
                                 name,
@@ -258,12 +260,6 @@ static int list_machines(int argc, char *argv[], void *userdata) {
                                 "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;
 
                 l = strlen(name);
                 if (l > max_name)