diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-23 04:36:38 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-01-23 04:36:38 +0000 |
commit | 7a260d20068e88bc40007268179665ac8eca6831 (patch) | |
tree | c3f1ef9ff138abb9622272745f73f409038a7335 | |
parent | d794eeed90bfe9c12b714ad6ae0f83f877421f89 (diff) |
Move a closefrom(2) into the block that execs su(1) where it can do the
most good. There is already another closefrom(2) for the normal code path.
Also remove a bogus comment. Discussed with deraadt@
-rw-r--r-- | usr.bin/login/login.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c index 1481bf2c085..acf1a1c4791 100644 --- a/usr.bin/login/login.c +++ b/usr.bin/login/login.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login.c,v 1.53 2004/01/23 03:48:43 deraadt Exp $ */ +/* $OpenBSD: login.c,v 1.54 2004/01/23 04:36:37 millert Exp $ */ /* $NetBSD: login.c,v 1.13 1996/05/15 23:50:16 jtc Exp $ */ /*- @@ -73,7 +73,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94"; #endif -static const char rcsid[] = "$OpenBSD: login.c,v 1.53 2004/01/23 03:48:43 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: login.c,v 1.54 2004/01/23 04:36:37 millert Exp $"; #endif /* not lint */ /* @@ -276,8 +276,6 @@ main(int argc, char *argv[]) } else ask = 1; - closefrom(3); - /* * If effective user is not root, just run su(1) to emulate login(1). */ @@ -286,6 +284,7 @@ main(int argc, char *argv[]) auth_close(as); closelog(); + closefrom(STDERR_FILENO + 1); ap = av; *ap++ = _PATH_SU; @@ -753,10 +752,6 @@ failed: /* * The last thing we do is discard all of the open file descriptors. * Last because the C library may have some open. - * - * XXX - * Assume that stdin, stdout and stderr are 0, 1 and 2, and that - * STDERR_FILENO is 2. */ closefrom(STDERR_FILENO + 1); |