|
|
923a60 |
From caff38650c2c1ae9244a30b87275db3d3a5e3b5d Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Lennart Poettering <lennart@poettering.net>
|
|
|
923a60 |
Date: Tue, 28 Apr 2015 12:12:29 +0200
|
|
|
923a60 |
Subject: [PATCH] bus-util: print correct warnings for units that fail but for
|
|
|
923a60 |
which we have a NULL result only
|
|
|
923a60 |
|
|
|
923a60 |
Cherry-picked from: 373a99e
|
|
|
923a60 |
Related: #1016680
|
|
|
923a60 |
---
|
|
|
923a60 |
src/libsystemd/sd-bus/bus-util.c | 34 +++++++++++++++++++-------------
|
|
|
923a60 |
1 file changed, 20 insertions(+), 14 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
index 017fbaf2a3..e48abf55a3 100644
|
|
|
923a60 |
--- a/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
+++ b/src/libsystemd/sd-bus/bus-util.c
|
|
|
923a60 |
@@ -1724,28 +1724,34 @@ static const struct {
|
|
|
923a60 |
};
|
|
|
923a60 |
|
|
|
923a60 |
static void log_job_error_with_service_result(const char* service, const char *result) {
|
|
|
923a60 |
- unsigned i;
|
|
|
923a60 |
_cleanup_free_ char *service_shell_quoted = NULL;
|
|
|
923a60 |
|
|
|
923a60 |
assert(service);
|
|
|
923a60 |
- assert(result);
|
|
|
923a60 |
|
|
|
923a60 |
service_shell_quoted = shell_maybe_quote(service);
|
|
|
923a60 |
|
|
|
923a60 |
- for (i = 0; i < ELEMENTSOF(explanations); ++i)
|
|
|
923a60 |
- if (streq(result, explanations[i].result))
|
|
|
923a60 |
- break;
|
|
|
923a60 |
+ if (!isempty(result)) {
|
|
|
923a60 |
+ unsigned i;
|
|
|
923a60 |
|
|
|
923a60 |
- if (i < ELEMENTSOF(explanations))
|
|
|
923a60 |
- log_error("Job for %s failed because %s. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
|
|
|
923a60 |
- service,
|
|
|
923a60 |
- explanations[i].explanation,
|
|
|
923a60 |
- strna(service_shell_quoted));
|
|
|
923a60 |
- else
|
|
|
923a60 |
- log_error("Job for %s failed. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
|
|
|
923a60 |
- service,
|
|
|
923a60 |
- strna(service_shell_quoted));
|
|
|
923a60 |
+ for (i = 0; i < ELEMENTSOF(explanations); ++i)
|
|
|
923a60 |
+ if (streq(result, explanations[i].result))
|
|
|
923a60 |
+ break;
|
|
|
923a60 |
+
|
|
|
923a60 |
+ if (i < ELEMENTSOF(explanations)) {
|
|
|
923a60 |
+ log_error("Job for %s failed because %s. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
|
|
|
923a60 |
+ service,
|
|
|
923a60 |
+ explanations[i].explanation,
|
|
|
923a60 |
+ strna(service_shell_quoted));
|
|
|
923a60 |
|
|
|
923a60 |
+ goto finish;
|
|
|
923a60 |
+ }
|
|
|
923a60 |
+ }
|
|
|
923a60 |
+
|
|
|
923a60 |
+ log_error("Job for %s failed. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
|
|
|
923a60 |
+ service,
|
|
|
923a60 |
+ strna(service_shell_quoted));
|
|
|
923a60 |
+
|
|
|
923a60 |
+finish:
|
|
|
923a60 |
/* For some results maybe additional explanation is required */
|
|
|
923a60 |
if (streq_ptr(result, "start-limit"))
|
|
|
923a60 |
log_info("To force a start use \"systemctl reset-failed %1$s\" followed by \"systemctl start %1$s\" again.",
|