[PATCH] Fix start-stop-daemon on no-MMU

Alex Landau landau_alex at yahoo.com
Wed Jul 25 08:41:19 UTC 2007


--- Mike Frysinger <vapier at gentoo.org> wrote:

> On Tuesday 24 July 2007, Alex Landau wrote:
> > You may also find some code duplications with the fork_and_reexec functions
> > (i.e. call to setsid, dupping /dev/null to 0,1 and 2),
> 
> there is a bb sanitize io function which could alleviate some of this isnt 
> there ?
> -mike
> 

No that won't work. bb_sanitize_stdio() goes over descriptors 0,1,2 and if any is closed,
connects it to /dev/null. I want to force them to be /dev/null.
Second, the dups and setsid are combined with the re-execing, while in the
start-stop-daemon case the child should continue and do some stuff before execing.
And last, either I don't understand something, or the bb_daemonize_or_rexec() function
that bb_sanitize_stdio() uses is broken: DAEMON_DEVNULL_STDIO is defined as 0, so we
never close 0,1,2 (unless we're also re-execing) and that "if" is dead code.

Alex


       
____________________________________________________________________________________
Choose the right car based on your needs.  Check out Yahoo! Autos new Car Finder tool.
http://autos.yahoo.com/carfinder/



More information about the busybox mailing list