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

Denis Vlasenko vda.linux at googlemail.com
Thu Aug 2 10:03:31 UTC 2007


On 8/2/07, Alex Landau <landau_alex at yahoo.com> wrote:
> --- Mike Frysinger <vapier at gentoo.org> wrote:
>
> > On Thursday 02 August 2007, Alex Landau wrote:
> > > +               if (pid != 0) /* parent */
> > > +                       exit(0); /* the child may have changed the stack,
> > > so no return possible, only function calls */ /* child */
> >
> > i havent read the code, but gut feeling says that should be _exit(0) ... or do
> > i need to read the code ? :)
> > -mike

Thanks for testing Alex, I am applying the patch.
I am also reusing write_pidfile() from libbb here:

        if (opt & OPT_MAKEPID) {
                /* user wants _us_ to make the pidfile */
                write_pidfile(pidfile);
        }

In the process I (hopefully) fixed that nasty
"ifupdown + udhcpc_without_pidpile_creation" fsckup...

> You do need to read the code :-)
> It's the parent who runs exit(), not the child, so it should be exit() and not _exit().

Mike is implying that _exit() is mucking around much less that exit()
and for paranoid
reasons we are better off using it. So I changed exit to _exit in that spot.
We don't even need to fflush() before that, we did no output yet.

> The child merely execv()s.

So on NOMMU execv() basically creates another process in another
memory region, and
terminates current one, unless there is a parent sitting in vfork and waiting
(in which case parent is woken up instead of exit)?
--
vda



More information about the busybox mailing list