chiark / gitweb /
umount: unescape path from /proc/self/mountinfo first, then check against api mount...
[elogind.git] / src / main.c
index 6c65e64a2eaa4dfc90febf37adc5891078e51699..15bd2e4d1562bf14ad2089811e4845ae3ab05b41 100644 (file)
@@ -545,11 +545,9 @@ static int parse_config_file(void) {
 }
 
 static int parse_proc_cmdline(void) {
-        char *line;
+        char *line, *w, *state;
         int r;
-        char *w;
         size_t l;
-        char *state;
 
         if ((r = read_one_line_file("/proc/cmdline", &line)) < 0) {
                 log_warning("Failed to read /proc/cmdline, ignoring: %s", strerror(-r));
@@ -1060,8 +1058,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_MASKED)
+                        log_error("Default target masked.");
 
                 if (!target || target->meta.load_state != UNIT_LOADED) {
                         log_info("Trying to load rescue target...");
@@ -1070,12 +1070,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_MASKED) {
+                                log_error("Rescue target masked.");
+                                goto finish;
                         }
                 }
 
+                assert(target->meta.load_state == UNIT_LOADED);
+
                 if (arg_action == ACTION_TEST) {
                         printf("-> By units:\n");
                         manager_dump_units(m, stdout, "\t");