X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Funit.c;h=a6cc3b6102140df840d708e03184579547948e2b;hp=e2c06ae8b638123fe2df8d90908fb3f408ea2f75;hb=6b19ad24d3b6ade48d9e3d29e5348fc6b8d7c811;hpb=37d3ab1b7e114f0fb6dfb2e7273569b42794b76a diff --git a/src/core/unit.c b/src/core/unit.c index e2c06ae8b..a6cc3b610 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1360,11 +1360,6 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su if (UNIT_IS_INACTIVE_OR_FAILED(os) != UNIT_IS_INACTIVE_OR_FAILED(ns)) { ExecContext *ec = unit_get_exec_context(u); if (ec && exec_context_may_touch_console(ec)) { - /* XXX The counter may get out of sync if the admin edits - * TTY-related unit file properties and issues a daemon-reload - * while the unit is active. No big deal though, because - * it influences only the printing of boot/shutdown - * status messages. */ if (UNIT_IS_INACTIVE_OR_FAILED(ns)) m->n_on_console--; else @@ -1517,7 +1512,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su /* Maybe we finished startup and are now ready for being * stopped because unneeded? */ - unit_check_unneeded(u); + if (u->manager->n_reloading <= 0) + unit_check_unneeded(u); unit_add_to_dbus_queue(u); unit_add_to_gc_queue(u); @@ -2451,6 +2447,9 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { job_free(j); return r; } + + if (j->state == JOB_RUNNING) + u->manager->n_running_jobs++; } else { /* legacy */ JobType type = job_type_from_string(v);