diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2012-04-20 10:21:37 +0200 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2012-04-20 17:12:27 +0200 |
commit | 97e7d748d1bf26790fc3b2607885f4ac8c4ecf3a (patch) | |
tree | bbabe2eb9589c28da467ba4e0d510ac7cd65e98f /src/core/manager.c | |
parent | 121b3b318042b7fd67ac96601971c1c2f9b77be5 (diff) |
job: job_uninstall()
Split the uninstallation of the job from job_free() into a separate function.
Adjust the callers.
job_free() now only works on unlinked and uninstalled jobs. This enforces clear
thinking about job lifetimes.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 546b3233b0..445931cb83 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1275,13 +1275,17 @@ static int transaction_apply(Manager *m, JobMode mode) { } while ((j = hashmap_steal_first(m->transaction_jobs))) { + Job *uj; if (j->installed) { /* log_debug("Skipping already installed job %s/%s as %u", j->unit->id, job_type_to_string(j->type), (unsigned) j->id); */ continue; } - if (j->unit->job) - job_free(j->unit->job); + uj = j->unit->job; + if (uj) { + job_uninstall(uj); + job_free(uj); + } j->unit->job = j; j->installed = true; |