1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 06:25:37 +03:00

nspawn: Set LANG to C.UTF-8

Let's default to a UTF-8 locale when running commands using nspawn.
This commit is contained in:
Daan De Meyer 2022-04-26 10:05:08 +01:00 committed by Luca Boccassi
parent 0b6bf4b674
commit b626f6959b

View File

@ -3218,6 +3218,7 @@ static int inner_child(
NULL, /* LISTEN_PID */
NULL, /* NOTIFY_SOCKET */
NULL, /* CREDENTIALS_DIRECTORY */
NULL, /* LANG */
NULL
};
const char *exec_target;
@ -3486,6 +3487,16 @@ static int inner_child(
n_env++;
}
if (arg_start_mode != START_BOOT) {
/* If we're running a command in the container, let's default to the C.UTF-8 locale as it's
* part of glibc these days and was backported to most distros a long time before it got
* added to upstream glibc. */
envp[n_env] = strdup("LANG=C.UTF-8");
if (!envp[n_env])
return log_oom();
n_env++;
}
env_use = strv_env_merge(envp, os_release_pairs, arg_setenv);
if (!env_use)
return log_oom();