X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fbus-util.c;h=ffcb333c8fda66a77a16cc5928734aed7295d296;hb=da1f9afa7ea68d5bb00b7dc4b704ba15226268be;hp=7ab687737eb87bbd8ff8629ecf80d4540f5b4999;hpb=6a5c729ef481ec9e770c6ed039abaf0e14145802;p=elogind.git diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c index 7ab687737..ffcb333c8 100644 --- a/src/shared/bus-util.c +++ b/src/shared/bus-util.c @@ -2041,8 +2041,8 @@ static const struct { { "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, *_journalctl; +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); @@ -2050,13 +2050,11 @@ static void log_job_error_with_service_result(const char* service, const char *r service_shell_quoted = shell_maybe_quote(service); if (extra_args && extra_args[1]) { - assert(extra_args[0] == NULL); + _cleanup_free_ char *t; - extra_args[0] = "systemctl"; - systemctl = _systemctl = strv_join((char**) extra_args, " "); - - extra_args[0] = "journalctl"; - journalctl = _journalctl = strv_join((char**) extra_args, " "); + t = strv_join((char**) extra_args, " "); + systemctl = strjoina("systemctl ", t ?: "", NULL); + journalctl = strjoina("journalctl ", t ?: "", NULL); } if (!isempty(result)) { @@ -2071,29 +2069,30 @@ static void log_job_error_with_service_result(const char* service, const char *r "See \"%s status %s\" and \"%s -xe\" for details.\n", service, explanations[i].explanation, - systemctl ?: "systemctl ", + systemctl, service_shell_quoted ?: "", - journalctl ?: "journalctl "); + journalctl); goto finish; } } - log_error("Job for %s failed. See \"%s status %s\" and \"%s -xe\" for details.\n", + log_error("Job for %s failed.\n" + "See \"%s status %s\" and \"%s -xe\" for details.\n", service, - systemctl ?: "systemctl ", + systemctl, service_shell_quoted ?: "", - journalctl ?: "journalctl "); + journalctl); 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\"\n" "followed by \"%1$s start %2$s\" again.", - systemctl ?: "systemctl ", + systemctl, service_shell_quoted ?: ""); } -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); @@ -2144,7 +2143,7 @@ static int check_wait_response(BusWaitForJobs *d, bool quiet, const char** extra 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);