Applied in hg tip, thanks Neale!

2008/11/4 Neale Pickett <[EMAIL PROTECTED]>:
> Reparenting everything to init with the double-fork is a nightmare on a
> many-user machine, especially when I'm logged in more than once.  pstree
> becomes useless.  This sets up a SIGCHLD handler and only forks once.
> Adds 2 SLOC, but surely there's some reason the double-fork is there that
> I'm just missing...
>
> void
> sigchld(int signal)
> {
>  while (0 < waitpid(-1, NULL, WNOHANG));
> }
>
> void
> spawn(const Arg *arg)
> {
>  signal(SIGCHLD, sigchld);
>  if (fork() == 0) {
>    if (dpy) close(ConnectionNumber(dpy));
>    setsid();
>    execvp(((char **)arg->v)[0], (char **)arg->v);
>    fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
>    perror(" failed");
>    exit(0);
>  }
> }

Reply via email to