summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-28 12:12:29 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-28 12:12:29 +0200
commit373a99e489ac0622ac2ed7f37e9670561c5835a8 (patch)
tree84d552cf8eccf84a6b4f7e90313e6e4fd01f184a /src/libsystemd/sd-bus
parenta22e1850c36e52cb9d593b99be59b6ba7639d80a (diff)
bus-util: print correct warnings for units that fail but for which we have a NULL result only
Diffstat (limited to 'src/libsystemd/sd-bus')
-rw-r--r--src/libsystemd/sd-bus/bus-util.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c
index a84d3381cb..a30493fb48 100644
--- a/src/libsystemd/sd-bus/bus-util.c
+++ b/src/libsystemd/sd-bus/bus-util.c
@@ -1758,28 +1758,34 @@ static const struct {
};
static void log_job_error_with_service_result(const char* service, const char *result) {
- unsigned i;
_cleanup_free_ char *service_shell_quoted = NULL;
assert(service);
- assert(result);
service_shell_quoted = shell_maybe_quote(service);
- for (i = 0; i < ELEMENTSOF(explanations); ++i)
- if (streq(result, explanations[i].result))
- break;
+ if (!isempty(result)) {
+ unsigned i;
- if (i < ELEMENTSOF(explanations))
- log_error("Job for %s failed because %s. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
- service,
- explanations[i].explanation,
- strna(service_shell_quoted));
- else
- log_error("Job for %s failed. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
- service,
- strna(service_shell_quoted));
+ for (i = 0; i < ELEMENTSOF(explanations); ++i)
+ if (streq(result, explanations[i].result))
+ break;
+
+ if (i < ELEMENTSOF(explanations)) {
+ log_error("Job for %s failed because %s. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
+ service,
+ explanations[i].explanation,
+ strna(service_shell_quoted));
+ goto finish;
+ }
+ }
+
+ log_error("Job for %s failed. See \"systemctl status %s\" and \"journalctl -xe\" for details.\n",
+ service,
+ strna(service_shell_quoted));
+
+finish:
/* For some results maybe additional explanation is required */
if (streq_ptr(result, "start-limit"))
log_info("To force a start use \"systemctl reset-failed %1$s\" followed by \"systemctl start %1$s\" again.",