From: Lennart Poettering Date: Wed, 6 Mar 2019 18:16:25 +0000 (+0100) Subject: bus-unit-util: move explanations array to inner scope X-Git-Tag: v242-rc1~131^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61e209eb3a960574e03c0a56a489cc25bc632171;p=thirdparty%2Fsystemd.git bus-unit-util: move explanations array to inner scope It's specific to service units, hence let's minimize the scope since it has no validity outside of the log message generation for service units. --- diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 1ed895bd374..6410b389e52 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -1921,23 +1921,23 @@ static int bus_job_get_service_result(BusWaitForJobs *d, char **result) { result); } -static const struct { - const char *result, *explanation; -} explanations [] = { - { "resources", "of unavailable resources or another system error" }, - { "protocol", "the service did not take the steps required by its unit configuration" }, - { "timeout", "a timeout was exceeded" }, - { "exit-code", "the control process exited with error code" }, - { "signal", "a fatal signal was delivered to the control process" }, - { "core-dump", "a fatal signal was delivered causing the control process to dump core" }, - { "watchdog", "the service failed to send watchdog ping" }, - { "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* const* extra_args) { _cleanup_free_ char *service_shell_quoted = NULL; const char *systemctl = "systemctl", *journalctl = "journalctl"; + static const struct { + const char *result, *explanation; + } explanations[] = { + { "resources", "of unavailable resources or another system error" }, + { "protocol", "the service did not take the steps required by its unit configuration" }, + { "timeout", "a timeout was exceeded" }, + { "exit-code", "the control process exited with error code" }, + { "signal", "a fatal signal was delivered to the control process" }, + { "core-dump", "a fatal signal was delivered causing the control process to dump core" }, + { "watchdog", "the service failed to send watchdog ping" }, + { "start-limit", "start of the service was attempted too often" } + }; + assert(service); service_shell_quoted = shell_maybe_quote(service, ESCAPE_BACKSLASH); @@ -1951,7 +1951,7 @@ static void log_job_error_with_service_result(const char* service, const char *r } if (!isempty(result)) { - unsigned i; + size_t i; for (i = 0; i < ELEMENTSOF(explanations); ++i) if (streq(result, explanations[i].result))