diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-12 17:42:58 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2012-04-12 17:42:58 +0000 |
commit | 2e8426d7c58ea94a61ef2e0bdf887f6c81d7e3b8 (patch) | |
tree | a0693b10dcc7a6092789651c050647c84fa8f20e | |
parent | a9c25bce4eb2242564115652664a51ad553f790d (diff) |
In this case where dup2() extends the table using fdalloc, the newly
selected fd is automatically fd_used(). We need to fd_unused() it,
because it will be fd_used() again in finishdup(). spotted by guenther
ok miod
-rw-r--r-- | sys/kern/kern_descrip.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index dca42ddc9d7..e6fd61c4fde 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_descrip.c,v 1.91 2012/04/12 11:07:20 deraadt Exp $ */ +/* $OpenBSD: kern_descrip.c,v 1.92 2012/04/12 17:42:57 deraadt Exp $ */ /* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */ /* @@ -279,6 +279,7 @@ restart: } if (new != i) panic("dup2: fdalloc"); + fd_unused(fdp, new); } /* finishdup() does FRELE */ error = finishdup(p, fp, old, new, retval, 1); |