mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-30 13:14:36 +00:00
LibCore: Add Stream::File::leak_fd(Badge<IPC::File>)
This commit is contained in:
parent
0cf29f6c45
commit
f0d2a8dd57
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue