From: Michal Schmidt Date: Thu, 27 Nov 2014 14:23:58 +0000 (+0100) Subject: core: fix transaction destructiveness check once more X-Git-Tag: v218~303 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=c21b92ffe7ef939dd32502ac912cf8ad1c5638fd core: fix transaction destructiveness check once more The previous fix e0312f4db "core: fix check for transaction destructiveness" broke test-engine (noticed by Zbyszek). Apparently I had a wrong idea of the intended semantics of --fail. The manpage says the operation should fail if it "conflicts with a pending job (more specifically: causes an already pending start job to be reversed into a stop job or vice versa)". So let's check job_type_is_conflicting, instead of !is_superset. This makes both test-engine and TEST-03-JOBS pass again. --- diff --git a/src/core/transaction.c b/src/core/transaction.c index b992eddf9..6ad11b2fd 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -511,7 +511,7 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro assert(!j->transaction_next); if (j->unit->job && (mode == JOB_FAIL || j->unit->job->irreversible) && - !job_type_is_superset(j->unit->job->type, j->type)) + job_type_is_conflicting(j->unit->job->type, j->type)) return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, "Transaction is destructive."); }