NRK writes:
On Tue, Jul 26, 2022 at 09:15:30PM +0100, Chris Down wrote:
- /* clean up any zombies immediately */
- sigchld(0);
+ if (sigaction(SIGCHLD, &sc, NULL)) {
+ perror("sigaction");
+ exit(EXIT_FAILURE);
+ }
Not too well versed on `sigaction` but what happens to any zombies
*before* the sigaction call? Don't we need to clean those up?
Can there really be zombies before setup()? At that point we haven't even
started in earnest yet, I don't see how a child would even get going.
The old call to sigchld() seems to just be there to install the handler for
later, not actually to reap zombies during setup().
Also `die` already calls perror, could just use:
if (sigaction(SIGCHLD, &sc, NULL) < 0)
die("sigaction failed:");
Oh, that's a good catch. die() it is for v2. :-)
The comparison against 0 is mostly personal, but the suckless coding
style recommends it as well: https://suckless.org/coding_style/
No strong preference, I'll put it in for v2.
Thanks!