update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
1 changed files with 11 additions and 5 deletions
Showing only changes of commit 94ce2c97be - Show all commits

View File

@ -701,11 +701,17 @@ BAN::String get_prompt()
} }
case 'u': case 'u':
{ {
auto* passwd = getpwuid(geteuid()); static char* username = nullptr;
if (passwd == nullptr) if (username == nullptr)
break; {
MUST(prompt.append(passwd->pw_name)); auto* passwd = getpwuid(geteuid());
endpwent(); if (passwd == nullptr)
break;
username = new char[strlen(passwd->pw_name) + 1];
strcpy(username, passwd->pw_name);
endpwent();
}
MUST(prompt.append(username));
break; break;
} }
case 'h': case 'h':