chiark / gitweb /
systemctl: fail in the case that no unit files were found
[elogind.git] / src / systemctl / systemctl.c
index 36db652..072f615 100644 (file)
@@ -1350,6 +1350,10 @@ static int list_unit_files(sd_bus *bus, char **args) {
                 }
 
                 n_units = hashmap_size(h);
+
+                if (n_units == 0)
+                        return 0;
+
                 units = new(UnitFileList, n_units);
                 if (!units) {
                         unit_file_list_free(h);