From 8fdacd25827ea30aa71ea14f9ac52ea3d01d3701 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 21 May 2024 22:17:56 -0400 Subject: kernel: filedesc: Fix fd_from_fdnum() Signed-off-by: Ian Moffett --- sys/kern/kern_filedesc.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sys/kern/kern_filedesc.c b/sys/kern/kern_filedesc.c index ec0aee7..17a3d84 100644 --- a/sys/kern/kern_filedesc.c +++ b/sys/kern/kern_filedesc.c @@ -181,13 +181,7 @@ fd_from_fdnum(const struct proc *td, int fdno) return NULL; } - for (size_t i = 0; i < PROC_MAX_FDS; ++i) { - if (i == fdno && td->fds[i] != NULL) { - return td->fds[i]; - } - } - - return NULL; + return td->fds[fdno]; } /* -- cgit v1.2.3