X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Ftransaction.c;h=ba7d8d9828087b68b2e3ca06853c955ed180fb7f;hb=5b1869eaa22e365ab6595924fe96549b279b5ebc;hp=27efef7cc68124d38990efeb941d9b7b466c42c8;hpb=31a7eb86f18b0466681d6fbe80c148f96c551c80;p=elogind.git diff --git a/src/core/transaction.c b/src/core/transaction.c index 27efef7cc..ba7d8d982 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -344,7 +344,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi assert(!j->transaction_prev); /* Does a recursive sweep through the ordering graph, looking - * for a cycle. If we find cycle we try to break it. */ + * for a cycle. If we find a cycle we try to break it. */ /* Have we seen this before? */ if (j->generation == generation) { @@ -371,7 +371,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi /* logging for j not k here here to provide consistent narrative */ log_info_unit(j->unit->id, - "Walked on cycle path to %s/%s", + "Found dependency on %s/%s", k->unit->id, job_type_to_string(k->type)); if (!delete && @@ -775,10 +775,10 @@ static Job* transaction_add_one_job(Transaction *tr, JobType type, Unit *unit, b j->override = override; j->irreversible = tr->irreversible; - LIST_PREPEND(Job, transaction, f, j); + LIST_PREPEND(transaction, f, j); if (hashmap_replace(tr->jobs, unit, f) < 0) { - LIST_REMOVE(Job, transaction, f, j); + LIST_REMOVE(transaction, f, j); job_free(j); return NULL; } @@ -860,7 +860,7 @@ int transaction_add_job_and_dependencies( return -EINVAL; } - if (type != JOB_STOP && (unit->load_state == UNIT_ERROR || unit->load_state == UNIT_NOT_FOUND)) { + if (type != JOB_STOP && unit->load_state == UNIT_ERROR) { dbus_set_error(e, BUS_ERROR_LOAD_FAILED, "Unit %s failed to load: %s. " "See system logs and 'systemctl status %s' for details.", @@ -870,6 +870,14 @@ int transaction_add_job_and_dependencies( return -EINVAL; } + if (type != JOB_STOP && unit->load_state == UNIT_NOT_FOUND) { + dbus_set_error(e, BUS_ERROR_LOAD_FAILED, + "Unit %s failed to load: %s.", + unit->id, + strerror(-unit->load_error)); + return -EINVAL; + } + if (type != JOB_STOP && unit->load_state == UNIT_MASKED) { dbus_set_error(e, BUS_ERROR_MASKED, "Unit %s is masked.", unit->id); return -EADDRNOTAVAIL;