summaryrefslogtreecommitdiff
path: root/src/core/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-05 17:22:10 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-05 17:54:59 +0100
commit9c3349e23b14db27e7ba45f82cf647899c563ea9 (patch)
tree387cb16085148be5626917ae4a83afdc3bc61d3e /src/core/unit.c
parentbbe05969ec5b8b89a20f052f63ebb3790c0c5574 (diff)
core: rework counting of running jobs
Let's unify the code that counts the running jobs a bit, in order to make sure we are less likely to miss one. This is related to this bug: https://bugs.freedesktop.org/show_bug.cgi?id=87349 However, it probably won't fix it fully, and I cannot reproduce the issue. The change also adds an explicit assert change when the counter is off.
Diffstat (limited to 'src/core/unit.c')
-rw-r--r--src/core/unit.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 9f7ba9227b..229bd0f73a 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2674,7 +2674,9 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) {
if (streq(l, "job")) {
if (v[0] == '\0') {
/* new-style serialized job */
- Job *j = job_new_raw(u);
+ Job *j;
+
+ j = job_new_raw(u);
if (!j)
return -ENOMEM;
@@ -2696,12 +2698,11 @@ 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);
+ JobType type;
+
+ type = job_type_from_string(v);
if (type < 0)
log_debug("Failed to parse job type value %s", v);
else