Check if lang is NULL and use shorter check (#303)

This commit is contained in:
Qontinuum 2022-05-12 20:37:43 +00:00 committed by GitHub
parent 1890da4799
commit da5b08abf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -213,22 +213,14 @@ void env_init(struct passwd* pwd)
char* lang = getenv("LANG");
// clean env
environ[0] = NULL;
if (term != NULL)
{
setenv("TERM", term, 1);
}
else
{
setenv("TERM", "linux", 1);
}
setenv("TERM", term ? term : "linux", 1);
setenv("HOME", pwd->pw_dir, 1);
setenv("PWD", pwd->pw_dir, 1);
setenv("SHELL", pwd->pw_shell, 1);
setenv("USER", pwd->pw_name, 1);
setenv("LOGNAME", pwd->pw_name, 1);
setenv("LANG", lang, 1);
setenv("LANG", lang ? lang : "C", 1);
// Set PATH if specified in the configuration
if (strlen(config.path))