kernel: Do not attempt to close non-existent FDs on exec()

This commit is contained in:
apio 2023-03-24 21:21:13 +01:00
parent 374a9ff7b8
commit 36e48b2ad2
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -80,6 +80,7 @@ Result<u64> sys_exec(Registers* regs, SyscallArgs args)
for (int i = 0; i < FD_MAX; i++)
{
auto& descriptor = current->fd_table[i];
if (!descriptor.has_value()) continue;
if (descriptor->flags & O_CLOEXEC) descriptor = {};
}