Add a workaround for sigwait returning 0 but not setting the signal number. This should never happen, but I've seen it in recent MacOS CI runs. It does not break the fuzzing engine, but may cause unnecessary cleanup timeout. PiperOrigin-RevId: 949626660
diff --git a/centipede/runner_fork_server.cc b/centipede/runner_fork_server.cc index 6f67717..237f95f 100644 --- a/centipede/runner_fork_server.cc +++ b/centipede/runner_fork_server.cc
@@ -349,6 +349,13 @@ if (sigwait(&wait_sigset, &sig) != 0) { Exit("###sigwait() failed\n"); } + if (sig == -1) { + // TODO(xinhaoyuan): This should never happen, but I've seen it happened + // on MacOS. Need further investigation. + Log("###sigwait() returns 0 without setting signal number!! Assuming " + "SIGCHLD\n"); + sig = SIGCHLD; + } if (sig == SIGINT) { Log("###Get SIGINT - ignoring\n"); } else if (sig == SIGTERM) {