1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibIPC: Close received IPC::File fd's by default unless taken

When receiving a file descriptor over IPC, the receiver must now call
take_fd() on the IPC::File to take over the descriptor. Otherwise,
IPC::File will close the file on destruction.
This commit is contained in:
Andreas Kling 2021-01-14 09:31:21 +01:00
parent 384d047e3e
commit 7f2d8e8884
5 changed files with 50 additions and 5 deletions

View file

@ -174,7 +174,7 @@ bool Decoder::decode([[maybe_unused]] File& file)
dbgln("recvfd: {}", strerror(errno));
return false;
}
file = File(fd);
file = File(fd, File::ConstructWithReceivedFileDescriptor);
return true;
#else
[[maybe_unused]] auto fd = m_sockfd;