check if we were previously on a signal stack before restoring.

OS X fails to restore the old signal stack because the signal stack is
not enabled by default. This causes sigaltstack(2) to fail with ENOMEM
as ss_size is 0, < MINSIGSTCKSZ.

ok jsing@
check for EINTR when calling waitpid.

ok jsing@
Better workaround for OS X sigaltstack() bug

OS X's sigaltstack() fails with ENOMEM if ss_size < MINSIGSTKSZ even
if SS_DISABLE is specified in ss_flags.  Rather than add code to try
to cope with this stupidity, just don't bother restoring the original
signal stack.
Minor cleanups

Rename _waitpid() to safewaitpid() to avoid POSIX reserved identifier
namespace.

KNF nit: return value expressions should be surrounded by parentheses,
per style(9).

Ensure SIGCHLD is set to SIG_DFL, not SIG_IGN.  POSIX allows (and
requires under XSI) that terminated child processes not leave zombies
if SIGCHLD is set to SIG_IGN, and it also allows execve() to leave
SIGCHLD set to SIG_IGN.