fd: effectively revert r305091
Turns out fd_lastfile can survive being -1 for some processes, giving incorrect results with the cast. Noted by: cem
This commit is contained in:
parent
9007a8679a
commit
44feca2360
@ -201,7 +201,7 @@ fget_locked(struct filedesc *fdp, int fd)
|
||||
|
||||
FILEDESC_LOCK_ASSERT(fdp);
|
||||
|
||||
if ((u_int)fd > fdp->fd_lastfile)
|
||||
if (fd < 0 || fd > fdp->fd_lastfile)
|
||||
return (NULL);
|
||||
|
||||
return (fdp->fd_ofiles[fd].fde_file);
|
||||
@ -213,7 +213,7 @@ fdeget_locked(struct filedesc *fdp, int fd)
|
||||
|
||||
FILEDESC_LOCK_ASSERT(fdp);
|
||||
|
||||
if ((u_int)fd > fdp->fd_lastfile)
|
||||
if (fd < 0 || fd > fdp->fd_lastfile)
|
||||
return (NULL);
|
||||
|
||||
return (&fdp->fd_ofiles[fd]);
|
||||
|
Loading…
Reference in New Issue
Block a user