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:
parent
2ef28602ba
commit
60f84f3154
Notes:
sideshowbarker
2024-07-18 10:30:58 +09:00
Author: https://github.com/timmot
Commit: 60f84f3154
Pull-request: https://github.com/SerenityOS/serenity/pull/8420
Reviewed-by: https://github.com/alimpfard
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