kernel: Do not attempt to close non-existent FDs on exec()
This commit is contained in:
parent
374a9ff7b8
commit
36e48b2ad2
@ -80,6 +80,7 @@ Result<u64> sys_exec(Registers* regs, SyscallArgs args)
|
|||||||
for (int i = 0; i < FD_MAX; i++)
|
for (int i = 0; i < FD_MAX; i++)
|
||||||
{
|
{
|
||||||
auto& descriptor = current->fd_table[i];
|
auto& descriptor = current->fd_table[i];
|
||||||
|
if (!descriptor.has_value()) continue;
|
||||||
if (descriptor->flags & O_CLOEXEC) descriptor = {};
|
if (descriptor->flags & O_CLOEXEC) descriptor = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user