summaryrefslogtreecommitdiff
path: root/src/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-01-22 02:18:59 +0100
committerLennart Poettering <lennart@poettering.net>2011-01-22 02:19:16 +0100
commitbd40a2d830265cdd36eb19576bdbe8e41dd527ee (patch)
tree65be055210412b9b3b961a153e7dc131ee7c653e /src/systemctl.c
parent0b1724894fb85aa1c07b2619e9269cfafd736956 (diff)
clang: fix some issues found with clang-analyzersystemd/v17
Diffstat (limited to 'src/systemctl.c')
-rw-r--r--src/systemctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index fb3430048c..8cdc01aa49 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -502,8 +502,10 @@ static int list_units(DBusConnection *bus, char **args, unsigned n) {
c++;
}
- qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
- output_units_list(unit_infos, c);
+ if (c > 0) {
+ qsort(unit_infos, c, sizeof(struct unit_info), compare_unit_info);
+ output_units_list(unit_infos, c);
+ }
r = 0;