- djm@cvs.openbsd.org 2008/02/22 05:58:56
     [session.c]
     closefrom() call was too early, delay it until just before we execute
     the user's rc files (if any).
diff --git a/ChangeLog b/ChangeLog
index 40672c4..5a8d92b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,10 @@
    - markus@cvs.openbsd.org 2008/02/20 15:25:26
      [session.c]
      correct boolean encoding for coredump; der Mouse via dugsong
+   - djm@cvs.openbsd.org 2008/02/22 05:58:56
+     [session.c]
+     closefrom() call was too early, delay it until just before we execute
+     the user's rc files (if any).
 
 20080302
  - (dtucker) [configure.ac] FreeBSD's glob() doesn't behave the way we expect
@@ -3677,4 +3681,4 @@
    OpenServer 6 and add osr5bigcrypt support so when someone migrates
    passwords between UnixWare and OpenServer they will still work. OK dtucker@
 
-$Id: ChangeLog,v 1.4854 2008/03/07 07:32:42 djm Exp $
+$Id: ChangeLog,v 1.4855 2008/03/07 07:33:12 djm Exp $
diff --git a/session.c b/session.c
index 7a97ae8..3eba513 100644
--- a/session.c
+++ b/session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: session.c,v 1.229 2008/02/20 15:25:26 markus Exp $ */
+/* $OpenBSD: session.c,v 1.230 2008/02/22 05:58:56 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -488,8 +488,6 @@
 		cray_init_job(s->pw); /* set up cray jid and tmpdir */
 #endif
 
-		closefrom(STDERR_FILENO + 1);
-
 		/* Do processing for the child (exec command etc). */
 		do_child(s, command);
 		/* NOTREACHED */
@@ -610,8 +608,6 @@
 # endif
 #endif
 
-		closefrom(STDERR_FILENO + 1);
-
 		/* Do common processing for the child, such as execing the command. */
 		do_child(s, command);
 		/* NOTREACHED */
@@ -1345,6 +1341,8 @@
 
 	}
 
+	closefrom(STDERR_FILENO + 1);
+
 	if (chdir(path) == -1)
 		fatal("Unable to chdir to chroot path \"%s\": "
 		    "%s", path, strerror(errno));