On Wednesday 13 June 2007 14:28, Maxime Bizon wrote:
> 
> On Wed, 2007-06-13 at 00:42 +0200, Denis Vlasenko wrote:
> 
> Hello Denis,
> 
> > Which daemons are not working?
> 
> I did not try any busybox daemon beside udhcpd which run fine. I had
> problem with non busybox code (personal code and hostapd).
> 
> I also got the following ash bug with echo builtin, which broke my rcS
> script:
> 
> > cd /
> > cat test.sh 
> #!/bin/sh
> 
> echo test1 > /foo
> echo test2
> 
> > ./unsanitize /bin/sh /test.sh 
> > cat /foo
> test1
> test2
> > 
> 
> unsanitize closes 0, 1 and 2 and exec argv[].
> 
> 
> > I would like to have all busybox applets work right even if they
> > happen to be started with some of fd 0,1,2 closed.
> 
> Agreed, this is good programming practice and may help reveal bugs.
> 
> But, as I told in another mail, a lot of (non busybox) code assumes that
> fd 0, 1 and 2 are open at startup.

I already said that init should be fixed too.
I am about to commit a fix which adds an else here:

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();
        }

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

Reply via email to