summaryrefslogtreecommitdiff
path: root/src/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-08 02:31:36 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-08 02:31:36 +0200
commit00dc5d769ac4a4019d6b6fe22e8383ec8b030a96 (patch)
treedb347d86cae6f68f70c085b6560cb313248f2166 /src/manager.c
parentc2b3f093d98a9751ba413c9b5d5c572a8a15932c (diff)
unit: introduce 'banned' load state for units symlinked to /dev/null
Diffstat (limited to 'src/manager.c')
-rw-r--r--src/manager.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/manager.c b/src/manager.c
index 4ee04e181f..26a631e9d7 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -1398,18 +1398,27 @@ static int transaction_add_job_and_dependencies(
assert(type < _JOB_TYPE_MAX);
assert(unit);
- if (unit->meta.load_state != UNIT_LOADED && unit->meta.load_state != UNIT_ERROR) {
+ if (unit->meta.load_state != UNIT_LOADED &&
+ unit->meta.load_state != UNIT_ERROR &&
+ unit->meta.load_state != UNIT_BANNED) {
dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->meta.id);
return -EINVAL;
}
if (type != JOB_STOP && unit->meta.load_state == UNIT_ERROR) {
- dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. You might find more information in the system logs.",
+ dbus_set_error(e, BUS_ERROR_LOAD_FAILED,
+ "Unit %s failed to load: %s. "
+ "You might find more information in the system logs.",
unit->meta.id,
strerror(-unit->meta.load_error));
return -EINVAL;
}
+ if (type != JOB_STOP && unit->meta.load_state == UNIT_BANNED) {
+ dbus_set_error(e, BUS_ERROR_BANNED, "Unit %s is banned.", unit->meta.id);
+ return -EINVAL;
+ }
+
if (!unit_job_is_applicable(unit, type)) {
dbus_set_error(e, BUS_ERROR_JOB_TYPE_NOT_APPLICABLE, "Job type %s is not applicable for unit %s.", job_type_to_string(type), unit->meta.id);
return -EBADR;