unit: fix assert when trying to load unit instances for uninstanciable types

http://lists.freedesktop.org/archives/systemd-devel/2011-April/001910.html
This commit is contained in:
Lennart Poettering
2011-04-28 01:26:42 +02:00
parent e190aa0be1
commit 796ba55494
2 changed files with 3 additions and 5 deletions
+3 -1
View File
@@ -118,8 +118,10 @@ int unit_add_name(Unit *u, const char *text) {
if ((r = unit_name_to_instance(s, &i)) < 0)
goto fail;
if (i && unit_vtable[t]->no_instances)
if (i && unit_vtable[t]->no_instances) {
r = -EINVAL;
goto fail;
}
/* Ensure that this unit is either instanced or not instanced,
* but not both. */