diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2022-12-07 18:46:50 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2023-01-06 14:52:29 +0000 |
commit | f0d2a8dd573028d0b3c9e1dce8b7c3e05789624a (patch) | |
tree | e93a247f81f4277c02780c389c2e3b15d9fe67dd /Userland | |
parent | 0cf29f6c457fe4d6f4b39c924806459b14fc7339 (diff) | |
download | serenity-f0d2a8dd573028d0b3c9e1dce8b7c3e05789624a.zip |
LibCore: Add `Stream::File::leak_fd(Badge<IPC::File>)`
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibCore/Stream.h | 8 |
1 files changed, 8 insertions, 0 deletions
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 <AK/Badge.h> #include <AK/CircularBuffer.h> #include <AK/DeprecatedString.h> #include <AK/EnumBits.h> @@ -19,6 +20,7 @@ #include <AK/Variant.h> #include <LibCore/Notifier.h> #include <LibCore/SocketAddress.h> +#include <LibIPC/Forward.h> #include <errno.h> #include <netdb.h> @@ -298,6 +300,12 @@ public: virtual ErrorOr<off_t> seek(i64 offset, SeekMode) override; virtual ErrorOr<void> 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) |