From 6b19ad24d3b6ade48d9e3d29e5348fc6b8d7c811 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Sat, 2 Mar 2013 12:29:04 +0100 Subject: [PATCH] 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. --- src/core/unit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 2f0ac00fc..a6cc3b610 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); -- 2.30.2