systemd/0012-core-transaction-avoid-misleading-error-message-when.patch

43 lines
1.9 KiB
Diff

Based on 04ef5b03f64d3824a51a2a903548af029a006744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Sun, 22 Jun 2014 14:04:23 -0400
Subject: [PATCH] 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
---
TODO | 4 ----
src/core/transaction.c | 18 ++++++++++++------
2 files changed, 12 insertions(+), 10 deletions(-)
--- src/core/transaction.c
+++ src/core/transaction.c 2014-06-24 11:18:42.746235805 +0000
@@ -865,12 +865,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;
}