summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index dc01d2833d9..3dc66fc2a06 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.97 2005/12/03 18:09:08 tedu Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.98 2005/12/07 19:04:53 deraadt Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -633,6 +633,10 @@ sys_execve(struct proc *p, void *v, register_t *retval)
p->p_emul != pack.ep_emul)
(*p->p_emul->e_proc_exit)(p);
+ p->p_descfd = 255;
+ if ((pack.ep_flags & EXEC_HASFD) && pack.ep_fd < 255)
+ p->p_descfd = pack.ep_fd;
+
/*
* Call exec hook. Emulation code may NOT store reference to anything
* from &pack.