summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/LanguageServers
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-14 09:31:21 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-14 09:50:14 +0100
commit7f2d8e88841bd1daf5583e24be4efb2946fc8402 (patch)
tree65313cbc24025bfbfd70f4d71d4421018322f345 /Userland/DevTools/HackStudio/LanguageServers
parent384d047e3e6d7004cd205c8262c31fe25785d54d (diff)
downloadserenity-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.cpp2
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/Shell/ClientConnection.cpp2
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");