Add command_manager_start(), encaps sigchild(): FIX Gavin Troy..
commitd6f316a49f8b444d623627f153b7a7ad6c823d0f
authorSteffen (Daode) Nurpmeso <sdaoden@users.sf.net>
Fri, 28 Feb 2014 12:08:49 +0000 (28 13:08 +0100)
committerSteffen (Daode) Nurpmeso <sdaoden@users.sf.net>
Fri, 28 Feb 2014 13:08:50 +0000 (28 14:08 +0100)
treead16a89f96724bf501e33bb10bcd305b80cc16bb
parent6add888337ae87cc6d515dca4540026a6c891dd7
Add command_manager_start(), encaps sigchild(): FIX Gavin Troy..

Gavin Troy reported on s-nail-users@ that using a pipe hook
results in a hang -- the reason was that in the ongoing effort to
clean the codebase the return values of system calls have (almost
all now hopefully) been changed from <0 to ==-1, but if that is
done in a braindead way, then something important may get lost.
In this case it was the fact that waitpid(2) may well report 0,
but especially with WNOHANG.

Instead of only fixing the return value issue, encapsulate child
process handling some more by internalizing sigchild() and instead
offering a command_manager_start() that is called from main.c
during startup.  Set SA_NOCLDSTOP if available to avoid useless
calls to the signal handler.  In theory we could drop WNOHANG, but
i'm afraid of doing so today.  Let's wait until some future time,
when all this is revisited.
extern.h
main.c
popen.c