1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00: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:
Andreas Kling 2019-10-18 14:13:43 +02:00
parent 2305dee455
commit 2f37fa487d
7 changed files with 27 additions and 31 deletions

View file

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