From 2e8426d7c58ea94a61ef2e0bdf887f6c81d7e3b8 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 12 Apr 2012 17:42:58 +0000 Subject: 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 --- sys/kern/kern_descrip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sys') 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); -- cgit v1.2.3