chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tree-wide: merge pager_open_if_enabled() to the pager_open()
[elogind.git]
/
src
/
shared
/
bus-util.c
diff --git
a/src/shared/bus-util.c
b/src/shared/bus-util.c
index 5fa39ce8c694a5292ef275260bbda176ce94d6e0..ffcb333c8fda66a77a16cc5928734aed7295d296 100644
(file)
--- a/
src/shared/bus-util.c
+++ b/
src/shared/bus-util.c
@@
-2041,20
+2041,21
@@
static const struct {
{ "start-limit", "start of the service was attempted too often" }
};
{ "start-limit", "start of the service was attempted too often" }
};
-static void log_job_error_with_service_result(const char* service, const char *result, const char *extra_args) {
- _cleanup_free_ char *service_shell_quoted = NULL, *systemctl_extra_args = NULL;
+static void log_job_error_with_service_result(const char* service, const char *result, const char* const* extra_args) {
+ _cleanup_free_ char *service_shell_quoted = NULL;
+ const char *systemctl = "systemctl", *journalctl = "journalct";
assert(service);
service_shell_quoted = shell_maybe_quote(service);
assert(service);
service_shell_quoted = shell_maybe_quote(service);
- systemctl_extra_args = strjoin("systemctl ", extra_args, " ", NULL);
- if (!systemctl_extra_args) {
- log_oom();
- return;
- }
+ if (extra_args && extra_args[1]) {
+ _cleanup_free_ char *t;
- systemctl_extra_args = strstrip(systemctl_extra_args);
+ t = strv_join((char**) extra_args, " ");
+ systemctl = strjoina("systemctl ", t ?: "<args>", NULL);
+ journalctl = strjoina("journalctl ", t ?: "<args>", NULL);
+ }
if (!isempty(result)) {
unsigned i;
if (!isempty(result)) {
unsigned i;
@@
-2064,30
+2065,34
@@
static void log_job_error_with_service_result(const char* service, const char *r
break;
if (i < ELEMENTSOF(explanations)) {
break;
if (i < ELEMENTSOF(explanations)) {
- log_error("Job for %s failed because %s. See \"%s status %s\" and \"journalctl -xe\" for details.\n",
+ log_error("Job for %s failed because %s.\n"
+ "See \"%s status %s\" and \"%s -xe\" for details.\n",
service,
explanations[i].explanation,
service,
explanations[i].explanation,
- systemctl
_extra_args
,
- s
trna(service_shell_quoted));
-
+ systemctl,
+ s
ervice_shell_quoted ?: "<service>",
+ journalctl);
goto finish;
}
}
goto finish;
}
}
- log_error("Job for %s failed. See \"%s status %s\" and \"journalctl -xe\" for details.\n",
+ log_error("Job for %s failed.\n"
+ "See \"%s status %s\" and \"%s -xe\" for details.\n",
service,
service,
- systemctl_extra_args,
- strna(service_shell_quoted));
+ systemctl,
+ service_shell_quoted ?: "<service>",
+ journalctl);
finish:
/* For some results maybe additional explanation is required */
if (streq_ptr(result, "start-limit"))
finish:
/* For some results maybe additional explanation is required */
if (streq_ptr(result, "start-limit"))
- log_info("To force a start use \"%1$s reset-failed %2$s\" followed by \"%1$s start %2$s\" again.",
- systemctl_extra_args,
- strna(service_shell_quoted));
+ log_info("To force a start use \"%1$s reset-failed %2$s\"\n"
+ "followed by \"%1$s start %2$s\" again.",
+ systemctl,
+ service_shell_quoted ?: "<service>");
}
}
-static int check_wait_response(BusWaitForJobs *d, bool quiet, const char
*
extra_args) {
+static int check_wait_response(BusWaitForJobs *d, bool quiet, const char
* const*
extra_args) {
int r = 0;
assert(d->result);
int r = 0;
assert(d->result);
@@
-2138,7
+2143,7
@@
static int check_wait_response(BusWaitForJobs *d, bool quiet, const char *extra_
return r;
}
return r;
}
-int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet, const char
*
extra_args) {
+int bus_wait_for_jobs(BusWaitForJobs *d, bool quiet, const char
* const*
extra_args) {
int r = 0;
assert(d);
int r = 0;
assert(d);