From: Michal Schmidt Date: Sat, 2 Mar 2013 11:29:04 +0000 (+0100) Subject: unit: count deserialized job only after it's definitely installed X-Git-Tag: upstream/198~114 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b19ad24d3b6ade48d9e3d29e5348fc6b8d7c811;p=platform%2Fupstream%2Fsystemd.git unit: count deserialized job only after it's definitely installed Installation of a deserialized job may fail (though purely in theory), so increase the running job counter only when succeeding. --- diff --git a/src/core/unit.c b/src/core/unit.c index 2f0ac00..a6cc3b6 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -2441,15 +2441,15 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds) { return r; } - if (j->state == JOB_RUNNING) - u->manager->n_running_jobs++; - r = job_install_deserialized(j); if (r < 0) { hashmap_remove(u->manager->jobs, UINT32_TO_PTR(j->id)); job_free(j); return r; } + + if (j->state == JOB_RUNNING) + u->manager->n_running_jobs++; } else { /* legacy */ JobType type = job_type_from_string(v);