mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-12 01:46:46 +02:00
Kernel: Keep TTY names in character buffers instead of Strings
Just going over some little unnecessary little kmalloc allocations.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 11:39:14 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/2f37fa487dc
@@ -966,7 +966,8 @@ int Process::sys$ttyname_r(int fd, char* buffer, ssize_t size)
|
||||
auto tty_name = description->tty()->tty_name();
|
||||
if (size < tty_name.length() + 1)
|
||||
return -ERANGE;
|
||||
strcpy(buffer, tty_name.characters());
|
||||
memcpy(buffer, tty_name.characters_without_null_termination(), tty_name.length());
|
||||
buffer[tty_name.length()] = '\0';
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user