diff options
author | John Crispin <blogic@openwrt.org> | 2013-11-09 20:20:55 +0100 |
---|---|---|
committer | John Crispin <blogic@openwrt.org> | 2013-11-09 20:20:55 +0100 |
commit | 582c88fdb55e01f3814e9c09a860651ed51a659d (patch) | |
tree | 8c3b3f1c9efb2b6c07087b95749afca96c2f1ff2 | |
parent | 315f04d8b823adda96041c17f6672b7790376ccb (diff) | |
download | unitd-582c88fdb55e01f3814e9c09a860651ed51a659d.tar unitd-582c88fdb55e01f3814e9c09a860651ed51a659d.zip |
bind the console to /dev/null if the real console fails to come up
this was reported on irc by oc80z
Signed-off-by: John Crispin <blogic@openwrt.org>
-rw-r--r-- | early.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -42,6 +42,7 @@ static void early_mounts(void) static void early_dev(void) { mkdev("*", 0600); + mknod("/dev/null", 0666, makedev(1, 3)); } static void early_console(const char *dev) @@ -55,10 +56,8 @@ static void early_console(const char *dev) } dd = open(dev, O_RDWR); - if (dd < 0) { - ERROR("Failed to open %s\n", dev); - return; - } + if (dd < 0) + dd = open("/dev/null", O_RDWR); dup2(dd, STDIN_FILENO); dup2(dd, STDOUT_FILENO); |