mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-18 21:55:45 +00:00
LibCore: Make it possible to create a CFile for an existing file descriptor.
This commit is contained in:
@@ -10,10 +10,18 @@ CFile::CFile(const String& filename)
|
||||
|
||||
CFile::~CFile()
|
||||
{
|
||||
if (mode() != NotOpen)
|
||||
if (m_should_close_file_descriptor == ShouldCloseFileDescriptor::Yes && mode() != NotOpen)
|
||||
close();
|
||||
}
|
||||
|
||||
bool CFile::open(int fd, CIODevice::OpenMode mode, ShouldCloseFileDescriptor should_close)
|
||||
{
|
||||
set_fd(fd);
|
||||
set_mode(mode);
|
||||
m_should_close_file_descriptor = should_close;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CFile::open(CIODevice::OpenMode mode)
|
||||
{
|
||||
int flags = 0;
|
||||
|
||||
Reference in New Issue
Block a user