diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-27 01:43:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-27 01:43:18 +0100 |
commit | f04fa1d5aa4ae76c6e95b986834b4223f51527b3 (patch) | |
tree | bc2bd83aacf4b43fab9d43e493da84b1329ffd15 /manager.c | |
parent | 01184e042b1798e9b2f688463637aaf3b0ef576f (diff) |
fully clean up job dependencies on abort, too
Diffstat (limited to 'manager.c')
-rw-r--r-- | manager.c | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -109,6 +109,24 @@ static void transaction_delete_unit(Manager *m, Unit *u) { transaction_delete_job(m, j); } +static void transaction_clean_dependencies(Manager *m) { + Iterator i; + Job *j; + + assert(m); + + /* Drops all dependencies of all installed jobs */ + + HASHMAP_FOREACH(j, m->jobs, i) { + while (j->subject_list) + job_dependency_free(j->subject_list); + while (j->object_list) + job_dependency_free(j->object_list); + } + + assert(!m->transaction_anchor); +} + static void transaction_abort(Manager *m) { Job *j; @@ -121,7 +139,8 @@ static void transaction_abort(Manager *m) { job_free(j); assert(hashmap_isempty(m->transaction_jobs)); - assert(!m->transaction_anchor); + + transaction_clean_dependencies(m); } static void transaction_find_jobs_that_matter_to_anchor(Manager *m, Job *j, unsigned generation) { @@ -539,14 +558,7 @@ static int transaction_apply(Manager *m, JobMode mode) { } /* As last step, kill all remaining job dependencies. */ - HASHMAP_FOREACH(j, m->jobs, i) { - while (j->subject_list) - job_dependency_free(j->subject_list); - while (j->object_list) - job_dependency_free(j->object_list); - } - - assert(!m->transaction_anchor); + transaction_clean_dependencies(m); return 0; |