[Bug?] init.c: problems if kernel gets console=null via cmdline
Denis Vlasenko
vda.linux at googlemail.com
Sun Jul 1 19:32:31 UTC 2007
On Sunday 01 July 2007 21:25, Harald Küthe wrote:
> Hello list,
>
> we have problems with the recent versions of busybox (1.5 and 1.6) when we start our kernel (2.4.34) without console.
> Some programs do not start e.g. samba server.
> When we link init to an older version of busybox thing get working.
> Debugging is difficult because the problem does not exist in a strace/gdb environement.
> It seems to be ok if I hack console_init() that it uses /dev/null as the console.
>
> Any help / direction is appreciated.
Try this: in init.c, add "else" clause as shown below:
static void console_init(void)
{
struct serial_struct sr;
char *s;
s = getenv("CONSOLE");
if (!s) s = getenv("console");
if (s) {
int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
if (fd >= 0) {
dup2(fd, 0);
dup2(fd, 1);
dup2(fd, 2);
while (fd > 2) close(fd--);
}
messageD(L_LOG, "console='%s'", s);
+ } else {
+ /* Make sure fd 0,1,2 are not closed */
+ bb_sanitize_stdio();
}
If it helps, I will add it in 1.6.2.
--
vda
More information about the busybox
mailing list