On Fri, Feb 08, 2013 at 03:58:46PM +0100, Marc-Antoine Perennou wrote:
> @@ -1493,8 +1499,13 @@ int main(int argc, char **argv)
>                       px = px->next;
>               }
>  
> -             if (proc == global.nbproc)
> +             if (proc == global.nbproc) {
> +                     if (global.mode & MODE_SYSTEMD) {
> +                             for (proc = 0; proc < global.nbproc; proc++)
> +                                     waitpid(children[proc], NULL, 0);
> +                     }
>                       exit(0); /* parent must leave */
> +             }
>  
>               /* if we're NOT in QUIET mode, we should now close the 3 first 
> FDs to ensure
>                * that we can detach from the TTY. We MUST NOT do it in other 
> cases since

I think we have an issue here, which should not be too hard to fix. The
parent is the one which binds to all the ports, so here it still owns
them. This means that a soft restart of a new process will fail until
the parent leaves, since it will not release these ports. And the parent
will not leave until all of its children have terminated. Or maybe I'm
missing something :-/

Also wouldn't it be worth catching EINTR here in the loop ? Otherwise
I fear that random signals sent to the process will make the for loop
progress to next child eventhough previous ones are not dead. This can
easily happen during debugging sessions (ctrl-Z/bg) or when people
mistakenly send a SIGHUP to the old process.

Willy


Reply via email to