mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +00:00
LibC: Implement getlogin().
This commit is contained in:
parent
a149ad9b44
commit
8175d75432
1 changed files with 6 additions and 1 deletions
|
@ -397,7 +397,12 @@ int seal_shared_buffer(int shared_buffer_id)
|
|||
|
||||
char* getlogin()
|
||||
{
|
||||
assert(false);
|
||||
static char __getlogin_buffer[256];
|
||||
if (auto* passwd = getpwuid(getuid())) {
|
||||
strncpy(__getlogin_buffer, passwd->pw_name, sizeof(__getlogin_buffer));
|
||||
return __getlogin_buffer;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue