Since [17937], the "controlling tty hack" code has been removed from
init.c.

It added an (I think) unwanted side effect.

The kernel may be unable to open a console, and then starts init without
any fd opened. The previous code would end up opening /dev/null and set
std(in|out|err) to it for any inittab line with "terminal" field empty,
but the new code doesn't, and it took me some time to understand why
some daemons were not working.

In case it's a mistake, this (very dirty) patch restore the old
behaviour.


--- busybox-1.6.0/init/init.c.old       2007-06-11 19:28:23.000000000 +0200
+++ busybox-1.6.0/init/init.c   2007-06-11 19:28:29.000000000 +0200
@@ -265,6 +265,7 @@
 {
        struct serial_struct sr;
        char *s;
+       int i;
 
        s = getenv("CONSOLE");
        if (!s) s = getenv("console");
@@ -290,6 +291,11 @@
 #endif
        } else if (!s)
                putenv((char*)"TERM=linux");
+
+       for (i = 0; i < 3; i++) {
+               if (dup2(i, i))
+                       dup2(i, device_open(bb_dev_null, O_RDWR));
+       }
 }
 
 static void fixup_argv(int argc, char **argv, const char *new_argv0)


-- 
Maxime

_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to