1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00: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
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;