diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2013-03-02 12:29:04 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2013-03-02 12:29:04 +0100 |
commit | 6b19ad24d3b6ade48d9e3d29e5348fc6b8d7c811 (patch) | |
tree | 003f9f09e0ad036855f30fa0082da84f45726134 | |
parent | cf843477946451fabf9b5d17eec8ec81515057b6 (diff) |
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.
-rw-r--r-- | src/core/unit.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/unit.c b/src/core/unit.c index 2f0ac00fcf..a6cc3b6102 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); |