mirror of
https://github.com/clearlinux/systemd-stable.git
synced 2026-09-07 22:21:45 +00:00
core: if we cannot JOB_ISOLATE the default target JOB_REPLACE it instead
In order to maintain compatibility with older initrds which do not have AllowIsolate=yes set for their target units, fallback to JOB_REPLACE if JOB_ISOLATE doesn't work, but complain about it.
This commit is contained in:
+13
-2
@@ -1736,11 +1736,22 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
|
||||
r = manager_add_job(m, JOB_START, target, JOB_ISOLATE, false, &error, &default_unit_job);
|
||||
if (r < 0) {
|
||||
log_error("Failed to start default target: %s", bus_error(&error, r));
|
||||
if (r == -EPERM) {
|
||||
log_error("Default target could not be isolated, starting instead: %s", bus_error(&error, r));
|
||||
dbus_error_free(&error);
|
||||
|
||||
r = manager_add_job(m, JOB_START, target, JOB_REPLACE, false, &error, &default_unit_job);
|
||||
if (r < 0) {
|
||||
log_error("Failed to start default target: %s", bus_error(&error, r));
|
||||
dbus_error_free(&error);
|
||||
goto finish;
|
||||
}
|
||||
} else if (r < 0) {
|
||||
log_error("Failed to isolate default target: %s", bus_error(&error, r));
|
||||
dbus_error_free(&error);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
m->default_unit_job_id = default_unit_job->id;
|
||||
|
||||
after_startup = now(CLOCK_MONOTONIC);
|
||||
|
||||
Reference in New Issue
Block a user