Index: llvm/trunk/lib/Support/Unix/Program.inc =================================================================== --- llvm/trunk/lib/Support/Unix/Program.inc +++ llvm/trunk/lib/Support/Unix/Program.inc @@ -245,12 +245,16 @@ Envp = const_cast(*_NSGetEnviron()); #endif - // Explicitly initialized to prevent what appears to be a valgrind false - // positive. - pid_t PID = 0; - int Err = posix_spawn(&PID, Program.str().c_str(), FileActions, - /*attrp*/ nullptr, const_cast(Argv), - const_cast(Envp)); + constexpr int maxRetries = 8; + int retries = 0; + pid_t PID; + int Err; + do { + PID = 0; // Make Valgrind happy. + Err = posix_spawn(&PID, Program.str().c_str(), FileActions, + /*attrp*/ nullptr, const_cast(Argv), + const_cast(Envp)); + } while (Err == EINTR && ++retries < maxRetries); if (FileActions) posix_spawn_file_actions_destroy(FileActions);