mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +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:
parent
2396b2ed70
commit
1606261c58
3 changed files with 1 additions and 22 deletions
|
@ -624,8 +624,7 @@ Process::Process(String&& name, uid_t uid, gid_t gid, pid_t ppid, RingLevel ring
|
|||
#ifdef FORK_DEBUG
|
||||
dbgprintf("fork: cloning fd %u... (%p) istty? %u\n", i, fork_parent->m_fds[i].description.ptr(), fork_parent->m_fds[i].description->is_tty());
|
||||
#endif
|
||||
m_fds[i].description = fork_parent->m_fds[i].description->clone();
|
||||
m_fds[i].flags = fork_parent->m_fds[i].flags;
|
||||
m_fds[i] = fork_parent->m_fds[i];
|
||||
}
|
||||
} else {
|
||||
m_fds.resize(m_max_open_file_descriptors);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue