diff options
author | Niels Provos <provos@cvs.openbsd.org> | 2000-04-01 23:29:26 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 2000-04-01 23:29:26 +0000 |
commit | 7976e0cb3d24d8d593689c231aeab56c367b4e0a (patch) | |
tree | 6f2a964fb335a8b82a41923449352ae93d041522 /sys/kern | |
parent | 679236a941e0335a18d186a3d9a5426dc320c607 (diff) |
fdup could fail when want for fdalloc > than the free fd in the block.
slightly different fix than in the bug report by
Rob Pickering <rob@syntonet.co.uk>
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_descrip.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 3f4e7396049..f3f15ed04de 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.19 2000/02/28 18:04:08 provos Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.20 2000/04/01 23:29:25 provos Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -619,6 +619,13 @@ fdalloc(p, want, result) i = find_next_zero(&fdp->fd_lomap[new], new > off ? 0 : i & NDENTRYMASK, NDENTRIES); + if (i == -1) { + /* free file descriptor in this block was + * below want, try again with higher want. + */ + want = (new + 1) << NDENTRYSHIFT; + continue; + } i += (new << NDENTRYSHIFT); if (i < last) { fd_used(fdp, i); |