mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-23 08:00:20 +00:00
LibC: Implement getlogin().
This commit is contained in:
parent
a149ad9b44
commit
8175d75432
Notes:
sideshowbarker
2024-07-19 15:05:42 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8175d754321
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…
Reference in a new issue