summaryrefslogtreecommitdiff
path: root/src/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-04-28 01:26:39 +0200
committerLennart Poettering <lennart@poettering.net>2011-04-28 01:26:42 +0200
commit796ba5549416b8a2c037da1d40fa76cb1a53f5df (patch)
treee549982164d3098fbea8d398ac8e91e09196c404 /src/unit.c
parente190aa0be1fa6cb1f56e036598ba90d58d16d9e8 (diff)
unit: fix assert when trying to load unit instances for uninstanciable types
http://lists.freedesktop.org/archives/systemd-devel/2011-April/001910.html
Diffstat (limited to 'src/unit.c')
-rw-r--r--src/unit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/unit.c b/src/unit.c
index aed25e4f21..b7ff0c51fe 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -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. */