sh: Prioritize /etc/passwd over the USER environment variable
This commit is contained in:
parent
18130847c1
commit
a935039e78
@ -71,12 +71,9 @@ Result<int> luna_main(int argc, char** argv)
|
||||
|
||||
if (getuid() == 0) prompt_end = '#';
|
||||
|
||||
username = getenv("USER");
|
||||
if (!username)
|
||||
{
|
||||
struct passwd* pw = getpwuid(getuid());
|
||||
if (pw) { username = pw->pw_name; }
|
||||
}
|
||||
struct passwd* pw = getpwuid(getuid());
|
||||
if (pw) { username = pw->pw_name; }
|
||||
else { username = getenv("USER"); }
|
||||
}
|
||||
|
||||
while (1)
|
||||
|
Loading…
Reference in New Issue
Block a user