diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-03-07 22:18:34 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-03-07 22:18:34 +0100 |
commit | ab17a050b778412b11c82f4fa974be9c491ead36 (patch) | |
tree | 53026f7275c4ecc64507d0b99917a9332530e22e /src | |
parent | 01ec23582dc0523831059fc05bedde16efd06576 (diff) |
core: if we cannot JOB_ISOLATE the default target JOB_REPLACE it insteadsystemd/v198
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/main.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/core/main.c b/src/core/main.c index 727a410740..7b039835a8 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -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); |