chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: in list-unit-files, always show legend, even if we know about no unit...
[elogind.git]
/
src
/
systemctl
/
systemctl.c
diff --git
a/src/systemctl/systemctl.c
b/src/systemctl/systemctl.c
index 540b4a64c1f5077f7c5364fb2bb37f5419ec4d97..d9b8bee28d740530608a31908b7f788e416a421a 100644
(file)
--- a/
src/systemctl/systemctl.c
+++ b/
src/systemctl/systemctl.c
@@
-1350,8
+1350,9
@@
static int list_unit_files(sd_bus *bus, char **args) {
}
n_units = hashmap_size(h);
}
n_units = hashmap_size(h);
+
units = new(UnitFileList, n_units);
units = new(UnitFileList, n_units);
- if (!units) {
+ if (!units
&& n_units > 0
) {
unit_file_list_free(h);
return log_oom();
}
unit_file_list_free(h);
return log_oom();
}
@@
-1407,14
+1408,13
@@
static int list_unit_files(sd_bus *bus, char **args) {
return bus_log_parse_error(r);
}
return bus_log_parse_error(r);
}
- if (c > 0) {
- qsort(units, c, sizeof(UnitFileList), compare_unit_file_list);
- output_unit_file_list(units, c);
- }
+ qsort_safe(units, c, sizeof(UnitFileList), compare_unit_file_list);
+ output_unit_file_list(units, c);
- if (avoid_bus())
+ if (avoid_bus())
{
for (unit = units; unit < units + c; unit++)
free(unit->path);
for (unit = units; unit < units + c; unit++)
free(unit->path);
+ }
return 0;
}
return 0;
}
@@
-4827,7
+4827,7
@@
static int switch_root(sd_bus *bus, char **args) {
const char *root_systemd_path = NULL, *root_init_path = NULL;
root_systemd_path = strappenda(root, "/" SYSTEMD_BINARY_PATH);
const char *root_systemd_path = NULL, *root_init_path = NULL;
root_systemd_path = strappenda(root, "/" SYSTEMD_BINARY_PATH);
- root_init_path = strappenda
3
(root, "/", init);
+ root_init_path = strappenda(root, "/", init);
/* If the passed init is actually the same as the
* systemd binary, then let's suppress it. */
/* If the passed init is actually the same as the
* systemd binary, then let's suppress it. */