X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Ftransaction.c;h=394c18135232663b93bd025d17f9d96360308cd7;hb=4e7bd268ae1f39675988b9ac61b9378a67e3ae3e;hp=398494778337b76c7163ab0286da105c36a1a60c;hpb=055163ad15a5ca1eb5626c63fa7163e152698e2b;p=elogind.git diff --git a/src/core/transaction.c b/src/core/transaction.c index 398494778..394c18135 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -603,6 +603,8 @@ rollback: } int transaction_activate(Transaction *tr, Manager *m, JobMode mode, DBusError *e) { + Iterator i; + Job *j; int r; unsigned generation = 1; @@ -611,6 +613,12 @@ int transaction_activate(Transaction *tr, Manager *m, JobMode mode, DBusError *e /* This applies the changes recorded in tr->jobs to * the actual list of jobs, if possible. */ + /* Reset the generation counter of all installed jobs. The detection of cycles + * looks at installed jobs. If they had a non-zero generation from some previous + * walk of the graph, the algorithm would break. */ + HASHMAP_FOREACH(j, m->jobs, i) + j->generation = 0; + /* First step: figure out which jobs matter */ transaction_find_jobs_that_matter_to_anchor(tr->anchor_job, generation++);