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 = '#';
|
if (getuid() == 0) prompt_end = '#';
|
||||||
|
|
||||||
username = getenv("USER");
|
struct passwd* pw = getpwuid(getuid());
|
||||||
if (!username)
|
if (pw) { username = pw->pw_name; }
|
||||||
{
|
else { username = getenv("USER"); }
|
||||||
struct passwd* pw = getpwuid(getuid());
|
|
||||||
if (pw) { username = pw->pw_name; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
Loading…
Reference in New Issue
Block a user