mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 04:37:55 +00:00
Kernel: Fix cloning file descriptions on fork
After a fork, the parent and the child are supposed to share the same file description. For example, modifying the current offset of a file description is visible in both of them.
This commit is contained in:
committed by
Andreas Kling
parent
2396b2ed70
commit
1606261c58
@@ -57,24 +57,6 @@ void FileDescription::set_socket_role(SocketRole role)
|
||||
socket()->attach(*this);
|
||||
}
|
||||
|
||||
NonnullRefPtr<FileDescription> FileDescription::clone()
|
||||
{
|
||||
RefPtr<FileDescription> description;
|
||||
if (is_fifo()) {
|
||||
description = fifo()->open_direction(m_fifo_direction);
|
||||
} else {
|
||||
description = FileDescription::create(m_file, m_socket_role);
|
||||
description->m_custody = m_custody;
|
||||
description->m_inode = m_inode;
|
||||
}
|
||||
ASSERT(description);
|
||||
description->m_current_offset = m_current_offset;
|
||||
description->m_is_blocking = m_is_blocking;
|
||||
description->m_should_append = m_should_append;
|
||||
description->m_file_flags = m_file_flags;
|
||||
return *description;
|
||||
}
|
||||
|
||||
KResult FileDescription::fstat(stat& buffer)
|
||||
{
|
||||
ASSERT(!is_fifo());
|
||||
|
||||
Reference in New Issue
Block a user