LibC: Implement getlogin().

This commit is contained in:
Andreas Kling 2019-03-10 03:15:36 +01:00
parent a149ad9b44
commit 8175d75432
Notes: sideshowbarker 2024-07-19 15:05:42 +09:00

View File

@ -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;
}
}