Set LC_ALL to control the locale

LANG specifies the default locale, LC_NUMERIC specifies the locale for
that particular category, but LC_ALL overrides all the locale
settings. Thus any user with LC_ALL set can still run into
locale-related problems.

Setting LC_ALL to C avoids any such issue.

See locale(7) for details.

Signed-off-by: Stephen Kitt <steve@sk2.org>
This commit is contained in:
Stephen Kitt
2022-02-10 08:26:34 +01:00
parent 64f4a8077e
commit c53166f630
+1 -2
View File
@@ -159,8 +159,7 @@ bool AsyncCommandExecutor::execute()
std::unique_ptr<gchar*, decltype(&g_strfreev)> child_env(g_get_environ(), &g_strfreev);
if (change_lang) {
child_env.reset(g_environ_setenv(child_env.release(), "LANG", "C", TRUE));
child_env.reset(g_environ_setenv(child_env.release(), "LC_NUMERIC", "C", TRUE));
child_env.reset(g_environ_setenv(child_env.release(), "LC_ALL", "C", TRUE));
}
std::vector<std::string> envp = Glib::ArrayHandler<std::string>::array_to_vector(child_env.release(),
Glib::OWNERSHIP_DEEP);