From d48e81f0cda73aca49cd852212a62e879cf35b86 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 6 Jul 2008 07:00:11 +0000 Subject: mdev: do not follow symlinks in /sys (as was intended prior to rev 18811). If this breaks things, please document why! mdev,init: use shared code for fd sanitization function old new delta bb_daemonize_or_rexec 155 172 +17 mdev_main 500 505 +5 init_main 907 856 -51 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 22/-51) Total: -29 bytes --- init/init.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'init') diff --git a/init/init.c b/init/init.c index 2328967..4b2bd9c 100644 --- a/init/init.c +++ b/init/init.c @@ -221,20 +221,7 @@ static void console_init(void) } else { /* Make sure fd 0,1,2 are not closed * (so that they won't be used by future opens) */ - - /* bb_sanitize_stdio(); - WRONG. - * It fails if "/dev/null" doesnt exist, and for init - * this is a real possibility! Open code it instead. */ - - int fd = open(bb_dev_null, O_RDWR); - if (fd < 0) { - /* Give me _ANY_ open descriptor! */ - fd = xopen("/", O_RDONLY); /* we don't believe this can fail */ - } - while ((unsigned)fd < 2) - fd = dup(fd); - if (fd > 2) - close(fd); + bb_sanitize_stdio(); } s = getenv("TERM"); -- cgit v1.1