1. Sample program attached. Change SIG_IGN to SIG_DFL to see the difference.

2. macOS seems to behave the same way, as does Linux.

3. I don't see where POSIX defines or allows this, but given 2., I'm surely
   missing something.

4. The wording in wait(2) could be improved to clarify this is only about 
   SIG_IGN, not SIG_DFL. At least, the NetBSD manpage mentions this at all.

5. Every time I think I knew Unix, I learn otherwise.
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>

int stat = 0;
int ret;

int main(int argc, char * argv[]) {
        signal(SIGCHLD, SIG_IGN);
        if (fork()) {
                if ((ret = wait(&stat)) < 0) err(1, "wait");
                printf("ret %d, stat %d\n", ret, stat);
        } else {
                exit(42);
        }
        return 0;
}

Reply via email to