chiark / gitweb /
core: actually make SwitchRoot() bus call do the deed
[elogind.git] / src / core / dbus-manager.c
index bc0c3109e393f41a3d6cda7d4eb9753ea3221b15..c560cac18fa47a6b3bac6f16de96e878ce256773 100644 (file)
@@ -547,11 +547,11 @@ static int method_start_transient_unit(sd_bus *bus, sd_bus_message *message, voi
         if (mode < 0)
                 return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Job mode %s is invalid.", smode);
 
-        r = manager_load_unit(m, name, NULL, error, &u);
+        r = selinux_access_check(bus, message, "start", error);
         if (r < 0)
                 return r;
 
-        r = selinux_unit_access_check(u, bus, message, "start", error);
+        r = manager_load_unit(m, name, NULL, error, &u);
         if (r < 0)
                 return r;
 
@@ -774,8 +774,9 @@ static int method_list_jobs(sd_bus *bus, sd_bus_message *message, void *userdata
                 r = sd_bus_message_append(
                                 reply, "(usssoo)",
                                 j->id,
-                                job_state_to_string(j->state),
+                                j->unit->id,
                                 job_type_to_string(j->type),
+                                job_state_to_string(j->state),
                                 job_path,
                                 unit_path);
                 if (r < 0)
@@ -1120,7 +1121,7 @@ static int method_switch_root(sd_bus *bus, sd_bus_message *message, void *userda
         if (!isempty(init)) {
                 ri = strdup(init);
                 if (!ri) {
-                        free(ri);
+                        free(rt);
                         return -ENOMEM;
                 }
         }
@@ -1131,6 +1132,8 @@ static int method_switch_root(sd_bus *bus, sd_bus_message *message, void *userda
         free(m->switch_root_init);
         m->switch_root_init = ri;
 
+        m->exit_code = MANAGER_SWITCH_ROOT;
+
         return sd_bus_reply_method_return(message, NULL);
 }