Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if lang is NULL and use shorter check #303

Merged
merged 3 commits into from May 12, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/login.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,22 +212,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 : "en_US.UTF-8, 1);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing closing quote "

i did the same thing for s6/obarun as workaround. though this works, this will likely break other systems that are not using EN locale since LANG and the rest will not be set anymore through /etc/profile, or skips /etc/vconsole.conf. ly has to run after LANG is normally set by system.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the double quote

Concerning the breakage that may occur, I don't see what is the issue with the things you mentionned. The value is just a default and is set in the case LANG is not already set. There is no bypass of the stuff set in /etc/profile and /etc/vconsole.conf using this method, is there?


// Set PATH if specified in the configuration
if (strlen(config.path))
Expand Down