summaryrefslogtreecommitdiff
path: root/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 04:42:36 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 18:00:20 +0200
commit819e213fbfecbb09d8e61a5463d2fbf155fa67f9 (patch)
tree3fc5a1bf2fc976a603e984b5432584947a61aed5 /unit.c
parent8b6c71206d32b11683e5e7cebc9acb467ba01b38 (diff)
unit: refuse merging if the unit in question has a job assigned or suchlike
Diffstat (limited to 'unit.c')
-rw-r--r--unit.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/unit.c b/unit.c
index 392be841d9..fe502dbff2 100644
--- a/unit.c
+++ b/unit.c
@@ -219,6 +219,7 @@ int unit_set_description(Unit *u, const char *description) {
void unit_add_to_load_queue(Unit *u) {
assert(u);
+ assert(u->meta.type != _UNIT_TYPE_INVALID);
if (u->meta.load_state != UNIT_STUB || u->meta.in_load_queue)
return;
@@ -239,6 +240,7 @@ void unit_add_to_cleanup_queue(Unit *u) {
void unit_add_to_dbus_queue(Unit *u) {
assert(u);
+ assert(u->meta.type != _UNIT_TYPE_INVALID);
if (u->meta.load_state == UNIT_STUB || u->meta.in_dbus_queue || set_isempty(u->meta.manager->subscribed))
return;
@@ -409,6 +411,12 @@ int unit_merge(Unit *u, Unit *other) {
other->meta.load_state != UNIT_FAILED)
return -EEXIST;
+ if (other->meta.job)
+ return -EEXIST;
+
+ if (unit_active_state(other) != UNIT_INACTIVE)
+ return -EEXIST;
+
/* Merge names */
merge_names(u, other);