Wrap waitpid with TEMP_FAILURE_RETRY and use __WALL to make sure we reap all children

PiperOrigin-RevId: 242111281
Change-Id: I322623303487b0292c2aea53d6eae5d9f53d79b6
This commit is contained in:
Kevin Hamacher 2019-04-05 05:49:53 -07:00 committed by Copybara-Service
parent 5b0c46fa18
commit e44231e28a

View File

@ -221,7 +221,7 @@ static void RunInitProcess(int signaling_fd, std::set<int> open_fds) {
// Wait until we don't have any children anymore. // Wait until we don't have any children anymore.
// We cannot watch for the child pid as ptrace steals our waitpid // We cannot watch for the child pid as ptrace steals our waitpid
// notifications. (See man ptrace / man waitpid). // notifications. (See man ptrace / man waitpid).
pid = waitpid(-1, &status, 0); pid = TEMP_FAILURE_RETRY(waitpid(-1, &status, __WALL));
if (pid < 0) { if (pid < 0) {
if (errno == ECHILD) { if (errno == ECHILD) {
_exit(0); _exit(0);