diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-03-22 17:07:18 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-03-22 20:30:40 +0100 |
commit | 16dbd110a7469f703cf17e5d15bce18e00fdc302 (patch) | |
tree | da70aab598d30696f56e7f51db91282c9f475f17 /src/vconsole | |
parent | c10d6bdb891881f68471dabd8100ea6021e6cdbb (diff) | |
download | systemd-16dbd110a7469f703cf17e5d15bce18e00fdc302.tar.gz |
vconsole-setup: don't concat strv if we don't need to (i.e. not in debug log mode)
Diffstat (limited to 'src/vconsole')
-rw-r--r-- | src/vconsole/vconsole-setup.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c index 92656c6383..b91968e81f 100644 --- a/src/vconsole/vconsole-setup.c +++ b/src/vconsole/vconsole-setup.c @@ -129,7 +129,6 @@ static int toggle_utf8_sysfs(bool utf8) { } static int keyboard_load_and_wait(const char *vc, const char *map, const char *map_toggle, bool utf8) { - _cleanup_free_ char *cmd = NULL; const char *args[8]; unsigned i = 0; pid_t pid; @@ -150,8 +149,12 @@ static int keyboard_load_and_wait(const char *vc, const char *map, const char *m args[i++] = map_toggle; args[i++] = NULL; - log_debug("Executing \"%s\"...", - strnull((cmd = strv_join((char**) args, " ")))); + if (DEBUG_LOGGING) { + _cleanup_free_ char *cmd; + + cmd = strv_join((char**) args, " "); + log_debug("Executing \"%s\"...", strnull(cmd)); + } r = safe_fork("(loadkeys)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_LOG, &pid); if (r < 0) @@ -165,7 +168,6 @@ static int keyboard_load_and_wait(const char *vc, const char *map, const char *m } static int font_load_and_wait(const char *vc, const char *font, const char *map, const char *unimap) { - _cleanup_free_ char *cmd = NULL; const char *args[9]; unsigned i = 0; pid_t pid; @@ -190,8 +192,12 @@ static int font_load_and_wait(const char *vc, const char *font, const char *map, args[i++] = font; args[i++] = NULL; - log_debug("Executing \"%s\"...", - strnull((cmd = strv_join((char**) args, " ")))); + if (DEBUG_LOGGING) { + _cleanup_free_ char *cmd; + + cmd = strv_join((char**) args, " "); + log_debug("Executing \"%s\"...", strnull(cmd)); + } r = safe_fork("(setfont)", FORK_RESET_SIGNALS|FORK_CLOSE_ALL_FDS|FORK_LOG, &pid); if (r < 0) |