From ccfc5fefc2425a6c6d91d4e6c50e1ee5cce7b0de Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Tue, 2 Mar 2010 23:53:19 -0800 Subject: [PATCH] --- yaml --- r: 185739 b: refs/heads/master c: 2bd3a997befc226ab4b504f05c5cbba305f3e0e6 h: refs/heads/master i: 185737: 27f24ccf98a26df8e99c0797100d28e60b4b5060 185735: b39ed1e5ea215c88df6d85306b9127e6ba0a10e5 v: v3 --- [refs] | 2 +- trunk/init/do_mounts_initrd.c | 4 ---- trunk/init/main.c | 11 ++++++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/[refs] b/[refs] index a1b5a9b7c3a8..ffe08d0dd2ce 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2329e392accdb1b277927e8d9cbf568ba3f3856d +refs/heads/master: 2bd3a997befc226ab4b504f05c5cbba305f3e0e6 diff --git a/trunk/init/do_mounts_initrd.c b/trunk/init/do_mounts_initrd.c index 614241b5200c..2b108538d0d9 100644 --- a/trunk/init/do_mounts_initrd.c +++ b/trunk/init/do_mounts_initrd.c @@ -30,11 +30,7 @@ static int __init do_linuxrc(void * shell) extern char * envp_init[]; sys_close(old_fd);sys_close(root_fd); - sys_close(0);sys_close(1);sys_close(2); sys_setsid(); - (void) sys_open("/dev/console",O_RDWR,0); - (void) sys_dup(0); - (void) sys_dup(0); return kernel_execve(shell, argv, envp_init); } diff --git a/trunk/init/main.c b/trunk/init/main.c index 4cb47a159f02..106e02d7ffa5 100644 --- a/trunk/init/main.c +++ b/trunk/init/main.c @@ -806,11 +806,6 @@ static noinline int init_post(void) system_state = SYSTEM_RUNNING; numa_default_policy(); - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - printk(KERN_WARNING "Warning: unable to open an initial console.\n"); - - (void) sys_dup(0); - (void) sys_dup(0); current->signal->flags |= SIGNAL_UNKILLABLE; @@ -873,6 +868,12 @@ static int __init kernel_init(void * unused) do_basic_setup(); + /* Open the /dev/console on the rootfs, this should never fail */ + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + printk(KERN_WARNING "Warning: unable to open an initial console.\n"); + + (void) sys_dup(0); + (void) sys_dup(0); /* * check if there is an early userspace init. If yes, let it do all * the work