mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:37:45 +00:00
LibC: Move the static String in getlogin() out of the function
For some reason, this stops it from adding __cxa_guard_acquire/release calls around its initialization. This unbreaks building ports.
This commit is contained in:
parent
27e86c03da
commit
386c7201d8
1 changed files with 5 additions and 4 deletions
|
@ -555,16 +555,17 @@ int set_process_icon(int icon_id)
|
||||||
__RETURN_WITH_ERRNO(rc, rc, -1);
|
__RETURN_WITH_ERRNO(rc, rc, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String getlogin_buffer;
|
||||||
|
|
||||||
char* getlogin()
|
char* getlogin()
|
||||||
{
|
{
|
||||||
static String buffer;
|
if (getlogin_buffer.is_null()) {
|
||||||
if (buffer.is_null()) {
|
|
||||||
if (auto* passwd = getpwuid(getuid())) {
|
if (auto* passwd = getpwuid(getuid())) {
|
||||||
buffer = String(passwd->pw_name);
|
getlogin_buffer = String(passwd->pw_name);
|
||||||
}
|
}
|
||||||
endpwent();
|
endpwent();
|
||||||
}
|
}
|
||||||
return const_cast<char*>(buffer.characters());
|
return const_cast<char*>(getlogin_buffer.characters());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ftruncate(int fd, off_t length)
|
int ftruncate(int fd, off_t length)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue