Skip to content

Commit 0db9bd2

Browse files
committed
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.
1 parent cd45734 commit 0db9bd2

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/core/locale-setup.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,28 @@ int locale_setup(char ***environment) {
7979
}
8080
}
8181

82-
if (!strv_isempty(add)) {
83-
char **e;
82+
if (strv_isempty(add)) {
83+
/* If no locale is configured then default to C.UTF-8. */
8484

85-
e = strv_env_merge(2, *environment, add);
86-
if (!e) {
85+
add = strv_new("LANG=C.UTF-8");
86+
if (!add) {
87+
r = -ENOMEM;
88+
goto finish;
89+
}
90+
}
91+
92+
if (strv_isempty(*environment))
93+
strv_free_and_replace(*environment, add);
94+
else {
95+
char **merged;
96+
97+
merged = strv_env_merge(2, *environment, add);
98+
if (!merged) {
8799
r = -ENOMEM;
88100
goto finish;
89101
}
90102

91-
strv_free_and_replace(*environment, e);
103+
strv_free_and_replace(*environment, merged);
92104
}
93105

94106
r = 0;

0 commit comments

Comments
 (0)