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