Only set envvar if it was already set

This commit is contained in:
xelantro 2024-02-12 23:12:46 +00:00 committed by GitHub
parent 4ee2b3ecc7
commit fb8fb7b22d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -220,7 +220,11 @@ void env_init(struct passwd* pwd)
setenv("SHELL", pwd->pw_shell, 1); setenv("SHELL", pwd->pw_shell, 1);
setenv("USER", pwd->pw_name, 1); setenv("USER", pwd->pw_name, 1);
setenv("LOGNAME", pwd->pw_name, 1); setenv("LOGNAME", pwd->pw_name, 1);
setenv("LANG", lang ? lang : "C", 1);
if (lang)
{
setenv("LANG", lang, 1);
}
// Set PATH if specified in the configuration // Set PATH if specified in the configuration
if (strlen(config.path)) if (strlen(config.path))