summaryrefslogtreecommitdiff
path: root/src/core/transaction.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/transaction.c')
-rw-r--r--src/core/transaction.c31
1 files changed, 7 insertions, 24 deletions
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 32ad660026..1c7efb207a 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -1,22 +1,4 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
-/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
-
- systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation; either version 2.1 of the License, or
- (at your option) any later version.
-
- systemd is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with systemd; If not, see <http://www.gnu.org/licenses/>.
-***/
#include <fcntl.h>
#include <unistd.h>
@@ -413,7 +395,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
j->unit->id,
unit_id == array ? "ordering cycle" : "dependency",
*unit_id, *job_type,
- unit_ids, NULL);
+ unit_ids);
if (delete) {
const char *status;
@@ -422,7 +404,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
"MESSAGE=%s: Job %s/%s deleted to break ordering cycle starting with %s/%s",
j->unit->id, delete->unit->id, job_type_to_string(delete->type),
j->unit->id, job_type_to_string(j->type),
- unit_ids, NULL);
+ unit_ids);
if (log_get_show_color())
status = ANSI_HIGHLIGHT_RED " SKIP " ANSI_NORMAL;
@@ -438,7 +420,7 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
log_struct(LOG_ERR,
"MESSAGE=%s: Unable to break cycle starting with %s/%s",
j->unit->id, j->unit->id, job_type_to_string(j->type),
- unit_ids, NULL);
+ unit_ids);
return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_ORDER_IS_CYCLIC,
"Transaction order is cyclic. See system logs for details.");
@@ -919,11 +901,13 @@ int transaction_add_job_and_dependencies(
/* by ? by->unit->id : "NA", */
/* by ? job_type_to_string(by->type) : "NA"); */
- if (!IN_SET(unit->load_state, UNIT_LOADED, UNIT_ERROR, UNIT_NOT_FOUND, UNIT_MASKED))
+ /* Safety check that the unit is a valid state, i.e. not in UNIT_STUB or UNIT_MERGED which should only be set
+ * temporarily. */
+ if (!IN_SET(unit->load_state, UNIT_LOADED, UNIT_ERROR, UNIT_NOT_FOUND, UNIT_BAD_SETTING, UNIT_MASKED))
return sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED, "Unit %s is not loaded properly.", unit->id);
if (type != JOB_STOP) {
- r = bus_unit_check_load_state(unit, e);
+ r = bus_unit_validate_load_state(unit, e);
if (r < 0)
return r;
}
@@ -933,7 +917,6 @@ int transaction_add_job_and_dependencies(
"Job type %s is not applicable for unit %s.",
job_type_to_string(type), unit->id);
-
/* First add the job. */
ret = transaction_add_one_job(tr, type, unit, &is_new);
if (!ret)