diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-03-06 19:16:25 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-03-13 17:38:43 +0100 |
commit | 61e209eb3a960574e03c0a56a489cc25bc632171 (patch) | |
tree | 2184eead6ab123ec1a9e19cc9e6e94cc37998cdf /src/shared/bus-unit-util.c | |
parent | 190c22189dc369258f03c3ca7f94badc82c18b21 (diff) | |
download | systemd-61e209eb3a960574e03c0a56a489cc25bc632171.tar.gz |
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.
Diffstat (limited to 'src/shared/bus-unit-util.c')
-rw-r--r-- | src/shared/bus-unit-util.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 1ed895bd37..6410b389e5 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)) |