diff options
-rw-r--r-- | src/main.c | 5 | ||||
-rw-r--r-- | src/manager.c | 2 | ||||
-rw-r--r-- | src/manager.h | 1 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index 738db6c264..18cc74a2ea 100644 --- a/src/main.c +++ b/src/main.c @@ -1404,6 +1404,7 @@ int main(int argc, char *argv[]) { } else { DBusError error; Unit *target = NULL; + Job *default_unit_job; dbus_error_init(&error); @@ -1440,11 +1441,13 @@ int main(int argc, char *argv[]) { manager_dump_units(m, stdout, "\t"); } - if ((r = manager_add_job(m, JOB_START, target, JOB_REPLACE, false, &error, NULL)) < 0) { + 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; } + m->default_unit_job_id = default_unit_job->id; after_startup = now(CLOCK_MONOTONIC); log_full(arg_action == ACTION_TEST ? LOG_INFO : LOG_DEBUG, diff --git a/src/manager.c b/src/manager.c index 19e5441722..74bd740747 100644 --- a/src/manager.c +++ b/src/manager.c @@ -2943,7 +2943,7 @@ bool manager_is_booting_or_shutting_down(Manager *m) { assert(m); /* Is the initial job still around? */ - if (manager_get_job(m, 1)) + if (manager_get_job(m, m->default_unit_job_id)) return true; /* Is there a job for the shutdown target? */ diff --git a/src/manager.h b/src/manager.h index 5e65fdb8fc..a9d08f0a25 100644 --- a/src/manager.h +++ b/src/manager.h @@ -183,6 +183,7 @@ struct Manager { int32_t subscribed_data_slot; uint32_t current_job_id; + uint32_t default_unit_job_id; /* Data specific to the Automount subsystem */ int dev_autofs_fd; |