diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-14 09:31:21 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-14 09:50:14 +0100 |
commit | 7f2d8e88841bd1daf5583e24be4efb2946fc8402 (patch) | |
tree | 65313cbc24025bfbfd70f4d71d4421018322f345 /Userland/DevTools/HackStudio/LanguageServers | |
parent | 384d047e3e6d7004cd205c8262c31fe25785d54d (diff) | |
download | serenity-7f2d8e88841bd1daf5583e24be4efb2946fc8402.zip |
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.
Diffstat (limited to 'Userland/DevTools/HackStudio/LanguageServers')
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp | 2 | ||||
-rw-r--r-- | Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp index 7952696b60..c8194636f4 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ClientConnection.cpp @@ -78,7 +78,7 @@ static DefaultDocumentClient s_default_document_client; void ClientConnection::handle(const Messages::LanguageServer::FileOpened& message) { auto file = Core::File::construct(this); - if (!file->open(message.file().fd(), Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { + if (!file->open(message.file().take_fd(), Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { errno = file->error(); perror("open"); dbgln("Failed to open project file"); diff --git a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp index 794085f618..ef85646868 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp @@ -78,7 +78,7 @@ static DefaultDocumentClient s_default_document_client; void ClientConnection::handle(const Messages::LanguageServer::FileOpened& message) { auto file = Core::File::construct(this); - if (!file->open(message.file().fd(), Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { + if (!file->open(message.file().take_fd(), Core::IODevice::ReadOnly, Core::File::ShouldCloseFileDescriptor::Yes)) { errno = file->error(); perror("open"); dbgln("Failed to open project file"); |