Index: sys/kern/kern_exec.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v
retrieving revision 1.107.2.14
diff -u -r1.107.2.14 kern_exec.c
--- sys/kern/kern_exec.c	21 Apr 2002 13:06:23 -0000	1.107.2.14
+++ sys/kern/kern_exec.c	30 Jul 2002 02:45:30 -0000
@@ -328,6 +328,8 @@
 				vrele(vtmp);
 			}
 		}
+		/* Close any file descriptors 0..2 that reference procfs */
+		setugidsafety(p);
 		/* Make sure file descriptors 0..2 are in use. */
 		error = fdcheckstd(p);
 		if (error != 0)
@@ -340,7 +342,6 @@
 			change_euid(p, attr.va_uid);
 		if (attr.va_mode & VSGID)
 			p->p_ucred->cr_gid = attr.va_gid;
-		setugidsafety(p);
 	} else {
 		if (p->p_ucred->cr_uid == p->p_cred->p_ruid &&
 		    p->p_ucred->cr_gid == p->p_cred->p_rgid)
