1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:27:45 +00:00

LibCore: Allow MappedFile to make File leak its fd

This commit is contained in:
Lucas CHOLLET 2023-02-14 15:28:15 -05:00 committed by Sam Atkins
parent 0f4a8731fd
commit 3a95c8111d

View file

@ -12,6 +12,7 @@
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <AK/Stream.h>
#include <LibCore/Forward.h>
#include <LibIPC/Forward.h>
namespace Core {
@ -67,7 +68,8 @@ public:
virtual ErrorOr<size_t> seek(i64 offset, SeekMode) override;
virtual ErrorOr<void> truncate(size_t length) override;
int leak_fd(Badge<::IPC::File>)
template<OneOf<::IPC::File, ::Core::MappedFile> VIP>
int leak_fd(Badge<VIP>)
{
m_should_close_file_descriptor = ShouldCloseFileDescriptor::No;
return m_fd;