Fixes segfault when environment does not set LANG

This commit is contained in:
Adam Christiansen 2020-03-22 16:38:24 -06:00
parent eb496b0db5
commit 2442599486
1 changed files with 9 additions and 7 deletions

View File

@ -227,7 +227,10 @@ 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, 1); if (lang != NULL)
{
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))
@ -677,4 +680,3 @@ void auth(
pam_diagnose(ok, buf); pam_diagnose(ok, buf);
} }
} }