]> err.no Git - systemd/commitdiff
main: properly fallback to rescue.target if default.target is hosed
authorLennart Poettering <lennart@poettering.net>
Tue, 17 Aug 2010 18:42:53 +0000 (20:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 17 Aug 2010 18:42:53 +0000 (20:42 +0200)
fixme
src/main.c

diff --git a/fixme b/fixme
index de3543e7b28d8e79dd47a93368513c58a325883b..077f85dd0dfc71e1c02f3ea80aab688acf3a5907 100644 (file)
--- a/fixme
+++ b/fixme
@@ -1,9 +1,5 @@
 * systemd.log_level=debug should overwrite 'quiet' ?
 
-* implicit 'default.target' ?
-  systemd currently fails to boot when the link is dangling, like
-  after the move of the runlevel targets from /etc to /lib
-
 * dot output for --test showing the 'initial transaction'
 
 * check 'disable'
index b0e1c2230b5ea67b696348e89beb1c2bf716ca69..2c91fe4578e7c8f7c98d37b5eb72c2b84a89fca0 100644 (file)
@@ -851,7 +851,6 @@ fail:
 
 int main(int argc, char *argv[]) {
         Manager *m = NULL;
-        Unit *target = NULL;
         int r, retval = 1;
         FDSet *fds = NULL;
         bool reexecute = false;
@@ -1004,6 +1003,7 @@ int main(int argc, char *argv[]) {
                 serialization = NULL;
         } else {
                 DBusError error;
+                Unit *target = NULL;
 
                 dbus_error_init(&error);
 
@@ -1012,12 +1012,19 @@ 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)
+                        log_error("Failed to load default target: %s", strerror(-target->meta.load_error));
 
+                if (!target || target->meta.load_state != UNIT_LOADED) {
                         log_info("Trying to load rescue target...");
+
                         if ((r = manager_load_unit(m, SPECIAL_RESCUE_TARGET, NULL, &error, &target)) < 0) {
                                 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) {
+                                log_error("Failed to load rescue target: %s", strerror(-target->meta.load_error));
+                                goto finish;
                         }
                 }