mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
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.
This commit is contained in:
parent
cf84347794
commit
6b19ad24d3
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user