diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-12-29 12:09:54 +0100 |
---|---|---|
committer | Martin Pitt <martin.pitt@ubuntu.com> | 2016-12-29 12:09:54 +0100 |
commit | 4b2419165ce409ee55ce96a926302f89685f2293 (patch) | |
tree | a0ff087c7cedc182020690b5da3f1db0a3ede7f3 /src/machine | |
parent | 41733ae1e0035c538505bc5be1ca5d67a80b4a82 (diff) |
machinectl: make sure that inability to get OS version isn't consider fatal for machine list (#4972)
Fixes: #4918
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machinectl.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index f85ef5b6ec..462667cf37 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -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) |