1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:08:13 +00:00

Kernel: Use move semantics in sys$sendfd()

Avoid an unnecessary NonnullRefPtr<OpenFileDescription> copy.
This commit is contained in:
Andreas Kling 2021-09-15 21:09:47 +02:00
parent 422d725c79
commit b6efd66d56
3 changed files with 4 additions and 4 deletions

View file

@ -23,9 +23,9 @@ KResultOr<FlatPtr> Process::sys$sendfd(int sockfd, int fd)
if (!socket.is_connected())
return ENOTCONN;
auto passing_descriptor = TRY(fds().open_file_description(fd));
auto passing_description = TRY(fds().open_file_description(fd));
auto& local_socket = static_cast<LocalSocket&>(socket);
return local_socket.sendfd(*socket_description, *passing_descriptor);
return local_socket.sendfd(*socket_description, move(passing_description));
}
KResultOr<FlatPtr> Process::sys$recvfd(int sockfd, int options)