1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09:00

LibCore: Add method to leak fd from File

This will let other code use the fd while making sure the fd isn't
automatically closed by Core::File's destructor
This commit is contained in:
Timothy 2021-07-04 14:42:51 +10:00 committed by Ali Mohammad Pur
parent 2ef28602ba
commit 60f84f3154
Notes: sideshowbarker 2024-07-18 10:30:58 +09:00
2 changed files with 7 additions and 0 deletions

View file

@ -92,6 +92,12 @@ bool File::open_impl(OpenMode mode, mode_t permissions)
return true;
}
int File::leak_fd()
{
m_should_close_file_descriptor = ShouldCloseFileDescriptor::No;
return fd();
}
bool File::is_device() const
{
struct stat stat;