summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-04-20 10:21:37 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-04-20 17:12:27 +0200
commit97e7d748d1bf26790fc3b2607885f4ac8c4ecf3a (patch)
treebbabe2eb9589c28da467ba4e0d510ac7cd65e98f /src/core/manager.c
parent121b3b318042b7fd67ac96601971c1c2f9b77be5 (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.c8
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;