mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:27:43 +00:00
Kernel: Fix overly eager fd closing in sys$execve()
When obeying FD_CLOEXEC, we don't need to explicitly call close() on all the FileDescriptions. We can just clear them out from the process fd table. ~FileDescription() will call close() anyway. This fixes an issue where TelnetServer would shut down accepted sockets when exec'ing a shell for them. Since the parent process still has the socket open, we should not force-close it. Just let go.
This commit is contained in:
parent
0930e2323b
commit
b058852c62
1 changed files with 1 additions and 4 deletions
|
@ -245,11 +245,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
|
||||
for (size_t i = 0; i < m_fds.size(); ++i) {
|
||||
auto& description_and_flags = m_fds[i];
|
||||
if (description_and_flags.description() && description_and_flags.flags() & FD_CLOEXEC) {
|
||||
// FIXME: Should this error path be observed somehow?
|
||||
(void)description_and_flags.description()->close();
|
||||
if (description_and_flags.description() && description_and_flags.flags() & FD_CLOEXEC)
|
||||
description_and_flags = {};
|
||||
}
|
||||
}
|
||||
|
||||
new_main_thread = nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue