diff options
author | 2004-01-23 04:36:37 +0000 | |
---|---|---|
committer | 2004-01-23 04:36:37 +0000 | |
commit | cf0aced1a1090721c0d4835384a7ca607aeaa5d7 (patch) | |
tree | 4ca430e233bf6391d965f8c2e674056cc6620f7e | |
parent | Use closefrom(); ok millert tedu (diff) | |
download | wireguard-openbsd-cf0aced1a1090721c0d4835384a7ca607aeaa5d7.tar.xz wireguard-openbsd-cf0aced1a1090721c0d4835384a7ca607aeaa5d7.zip |
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); |