diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-11-12 13:12:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-11-14 17:01:54 +0100 |
commit | 0db9bd200f62a5707ea16552537dcaad2d9e9331 (patch) | |
tree | 74334bc67ce0ad12994cde22302fc531828e6df0 /src | |
parent | cd45734f8700feb66409774d8830d6541f6bb294 (diff) | |
download | systemd-0db9bd200f62a5707ea16552537dcaad2d9e9331.tar.gz systemd-0db9bd200f62a5707ea16552537dcaad2d9e9331.tar.bz2 systemd-0db9bd200f62a5707ea16552537dcaad2d9e9331.zip |
locale-setup: default to C.UTF-8
Most distributions already were shipping a C.UTF-8 locale and even Fedora
now supports the C.UTF-8 locale, and there's clear indication that this
is going upstream too. Hence, let's default to it now too, if nothing
else is set.
Note that this is only a fallback if noting else is set, and since
distros generally configure a default for this behaviour shouldn't
really change in installed systems.
On new systems this makes vconsole.conf redundant.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/locale-setup.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c index 5fd54773b3..dc6157624d 100644 --- a/src/core/locale-setup.c +++ b/src/core/locale-setup.c @@ -79,16 +79,28 @@ int locale_setup(char ***environment) { } } - if (!strv_isempty(add)) { - char **e; + if (strv_isempty(add)) { + /* If no locale is configured then default to C.UTF-8. */ - e = strv_env_merge(2, *environment, add); - if (!e) { + add = strv_new("LANG=C.UTF-8"); + if (!add) { + r = -ENOMEM; + goto finish; + } + } + + if (strv_isempty(*environment)) + strv_free_and_replace(*environment, add); + else { + char **merged; + + merged = strv_env_merge(2, *environment, add); + if (!merged) { r = -ENOMEM; goto finish; } - strv_free_and_replace(*environment, e); + strv_free_and_replace(*environment, merged); } r = 0; |