summaryrefslogtreecommitdiff
path: root/src/main.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/main.c
parentc2b3f093d98a9751ba413c9b5d5c572a8a15932c (diff)
unit: introduce 'banned' load state for units symlinked to /dev/null
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 6c65e64a2e..d6f5c56c2a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1060,8 +1060,10 @@ int main(int argc, char *argv[]) {
if ((r = manager_load_unit(m, arg_default_unit, NULL, &error, &target)) < 0) {
log_error("Failed to load default target: %s", bus_error(&error, r));
dbus_error_free(&error);
- } else if (target->meta.load_state != UNIT_LOADED)
+ } else if (target->meta.load_state == UNIT_ERROR)
log_error("Failed to load default target: %s", strerror(-target->meta.load_error));
+ else if (target->meta.load_state == UNIT_BANNED)
+ log_error("Default target banned.");
if (!target || target->meta.load_state != UNIT_LOADED) {
log_info("Trying to load rescue target...");
@@ -1070,12 +1072,17 @@ int main(int argc, char *argv[]) {
log_error("Failed to load rescue target: %s", bus_error(&error, r));
dbus_error_free(&error);
goto finish;
- } else if (target->meta.load_state != UNIT_LOADED) {
+ } else if (target->meta.load_state == UNIT_ERROR) {
log_error("Failed to load rescue target: %s", strerror(-target->meta.load_error));
goto finish;
+ } else if (target->meta.load_state == UNIT_BANNED) {
+ log_error("Rescue target banned.");
+ goto finish;
}
}
+ assert(target->meta.load_state == UNIT_LOADED);
+
if (arg_action == ACTION_TEST) {
printf("-> By units:\n");
manager_dump_units(m, stdout, "\t");