From 5bdb21d48a557ae80d167ef3684bd9b1edb6b4f7 Mon Sep 17 00:00:00 2001 From: thorpej Date: Sun, 1 Jul 2001 18:12:00 +0000 Subject: [PATCH] Duh, use fd_getfile() in sys_close(). --- sys/kern/kern_descrip.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index d0f75e55c72c..94c49f33c2f7 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_descrip.c,v 1.78 2001/06/16 08:28:39 jdolecek Exp $ */ +/* $NetBSD: kern_descrip.c,v 1.79 2001/07/01 18:12:00 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991, 1993 @@ -497,11 +497,14 @@ sys_close(struct proc *p, void *v, register_t *retval) } */ *uap = v; int fd; struct filedesc *fdp; + struct file *fp; fd = SCARG(uap, fd); fdp = p->p_fd; - if ((u_int)fd >= fdp->fd_nfiles) + + if ((fp = fd_getfile(fdp, fd)) == NULL) return (EBADF); + return (fdrelease(p, fd)); }