From f0d2a8dd573028d0b3c9e1dce8b7c3e05789624a Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 7 Dec 2022 18:46:50 +0100 Subject: LibCore: Add `Stream::File::leak_fd(Badge)` --- Userland/Libraries/LibCore/Stream.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Userland/Libraries/LibCore/Stream.h') diff --git a/Userland/Libraries/LibCore/Stream.h b/Userland/Libraries/LibCore/Stream.h index 8d3546f861..66546b3462 100644 --- a/Userland/Libraries/LibCore/Stream.h +++ b/Userland/Libraries/LibCore/Stream.h @@ -7,6 +7,7 @@ #pragma once +#include #include #include #include @@ -19,6 +20,7 @@ #include #include #include +#include #include #include @@ -298,6 +300,12 @@ public: virtual ErrorOr seek(i64 offset, SeekMode) override; virtual ErrorOr truncate(off_t length) override; + int leak_fd(Badge<::IPC::File>) + { + m_should_close_file_descriptor = ShouldCloseFileDescriptor::No; + return m_fd; + } + virtual ~File() override { if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes) -- cgit v1.2.3