:: Re: [DNG] Lead BusyBox developer on…
Pàgina inicial
Delete this message
Reply to this message
Autor: Rainer Weikusat
Data:  
A: dng
Assumpte: Re: [DNG] Lead BusyBox developer on sysvinit
Steve Litt <slitt@???> writes:

[...]

> My opinion is that although this is indeed a bad thing, I'm
> willing to risk it to get the breathtaking simplicity of Rich
> Felker's vision in http://ewontfix.com/14/.


Process #1 doesn't receive signals unless it installed a handler for
them. This means blocking signals around the fork intended to confuse
what the main operation of the program in question happens to be (reap
orphaned processes) is useless.

The setpgid(0, 0) does nothing because setsid already put the process
into its own process group.

A minimal variant of that which is less contorted and actually a valid C
program could look like this:

----
#include <unistd.h>
#include <sys/wait.h>

int main(void)
{
    if (getpid() != 1) return 1;


    if (fork() == 0) {
    setsid();
    execve("/etc/rc", (char *[]){ "rc", 0 }, (char *[]){ 0 });
    }


    while (1) wait(NULL);


    return 0;
}
----


But don't let that deter from assuming that whoever screams the loudest
must be the greated ...