summaryrefslogtreecommitdiff
path: root/src/core/transaction.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-06-22 14:04:23 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-06-22 15:30:24 -0400
commit04ef5b03f64d3824a51a2a903548af029a006744 (patch)
tree678209fefe491b1785f4ba8f705d862995d8056b /src/core/transaction.c
parent9ba6c18532b4da96ae6916865c3db44054c2af6b (diff)
core/transaction: avoid misleading error message when unit not found
There's no point in telling the user to look at the logs when an attempt to load the unit file failed with ENOENT. https://bugzilla.redhat.com/show_bug.cgi?id=996133
Diffstat (limited to 'src/core/transaction.c')
-rw-r--r--src/core/transaction.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/core/transaction.c b/src/core/transaction.c
index 9fb6101ea9..d23a45c3f5 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -870,12 +870,18 @@ int transaction_add_job_and_dependencies(
}
if (type != JOB_STOP && unit->load_state == UNIT_ERROR) {
- sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED,
- "Unit %s failed to load: %s. "
- "See system logs and 'systemctl status %s' for details.",
- unit->id,
- strerror(-unit->load_error),
- unit->id);
+ if (unit->load_error == -ENOENT)
+ sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED,
+ "Unit %s failed to load: %s.",
+ unit->id,
+ strerror(-unit->load_error));
+ else
+ sd_bus_error_setf(e, BUS_ERROR_LOAD_FAILED,
+ "Unit %s failed to load: %s. "
+ "See system logs and 'systemctl status %s' for details.",
+ unit->id,
+ strerror(-unit->load_error),
+ unit->id);
return -EINVAL;
}