Fix new_fd validation to use resource limits in `do_dup3`

This commit is contained in:
Marsman1996 2026-01-20 15:25:42 +08:00 committed by Jianfeng Jiang
parent 6520682360
commit 43f570730c
1 changed files with 2 additions and 2 deletions

View File

@ -56,12 +56,12 @@ fn do_dup3(
return_errno!(Errno::EINVAL);
}
if new_fd
if new_fd.cast_unsigned() as u64
>= ctx
.process
.resource_limits()
.get_rlimit(ResourceType::RLIMIT_NOFILE)
.get_cur() as FileDesc
.get_cur()
{
return_errno!(Errno::EBADF);
}