From a7353b4d1450accd189e848a5355693f026542f1 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 25 Nov 2017 19:11:57 +0900 Subject: [PATCH] firstboot: do not write vconsole.conf when arg_keymap is empty --- src/firstboot/firstboot.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index afbfa37..207ddeb 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -346,13 +346,15 @@ static int process_keymap(void) { if (r < 0) return r; - if (!isempty(arg_keymap)) - keymap = STRV_MAKE(strjoina("KEYMAP=", arg_keymap)); - - if (!keymap) + if (isempty(arg_keymap)) return 0; - mkdir_parents(etc_vconsoleconf, 0755); + keymap = STRV_MAKE(strjoina("KEYMAP=", arg_keymap)); + + r = mkdir_parents(etc_vconsoleconf, 0755); + if (r < 0) + return log_error_errno(r, "Failed to create the parent directory of %s: %m", etc_vconsoleconf); + r = write_env_file(etc_vconsoleconf, keymap); if (r < 0) return log_error_errno(r, "Failed to write %s: %m", etc_vconsoleconf); -- 2.7.4