Re: [PATCH] Console: fall back to /dev/null when no console isavaillable

From: Gianni Tedesco
Date: Wed Oct 06 2004 - 13:40:23 EST


On Tue, 2004-10-05 at 20:52 +0200, JÃrn Engel wrote:
>
> main.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletion(-)
>
> --- linux-2.6.8cow/init/main.c~console 2004-10-05 20:46:40.000000000 +0200
> +++ linux-2.6.8cow/init/main.c 2004-10-05 20:46:08.000000000 +0200
> @@ -695,8 +695,11 @@
> system_state = SYSTEM_RUNNING;
> numa_default_policy();
>
> - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
> + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) {
> printk("Warning: unable to open an initial console.\n");
> + if (open("/dev/null", O_RDWR, 0) == 0)
> + printk(" Falling back to /dev/null.\n");
> + }

BTW. What happens if /dev/console or /dev/null are regular files?

I don't see any check for this. I didn't think Linux imposed any
namespace layout/ownership/permission requirements.

--
// Gianni Tedesco (gianni at scaramanga dot co dot uk)
lynx --source www.scaramanga.co.uk/scaramanga.asc | gpg --import

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/