diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-04 19:40:56 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-12-04 19:40:56 +0000 |
commit | 8fe046fefe1abaf3becc0f8cfd723e618deb0a9d (patch) | |
tree | 2eec73b03101f49e3c760995045b1bdc47c8929f /sys/kern/kern_descrip.c | |
parent | 8b4a4d8a81f1a5a5726b527185c202c3915d29d3 (diff) |
consider limits, in fdavail(); michaels@inet.no
Diffstat (limited to 'sys/kern/kern_descrip.c')
-rw-r--r-- | sys/kern/kern_descrip.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index bd032c20b9a..88791fbc03d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.15 1998/03/01 19:34:12 deraadt Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.16 1998/12/04 19:40:55 deraadt Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -589,7 +589,7 @@ fdavail(p, n) if ((i = lim - fdp->fd_nfiles) > 0 && (n -= i) <= 0) return (1); fpp = &fdp->fd_ofiles[fdp->fd_freefile]; - for (i = fdp->fd_nfiles - fdp->fd_freefile; --i >= 0; fpp++) + for (i = min(lim, fdp->fd_nfiles) - fdp->fd_freefile; --i >= 0; fpp++) if (*fpp == NULL && --n <= 0) return (1); return (0); |