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:
parent
2ef28602ba
commit
60f84f3154
2 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue