Fix bug where sys::Wait could wait on wrong pid.
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 27 Oct 2014 20:30:04 +0000 (20:30 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 27 Oct 2014 20:30:04 +0000 (20:30 +0000)
Setting ChildPid to -1 would cause waitpid to wait for any child process.

Patch by Daniel Reynaud!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220717 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/Unix/Program.inc

index 905c78f79bc323916eb4ac67ee7d21e278dbfc0c..7bf6eceda73389b35f75037abc72aa787e9e3527 100644 (file)
@@ -335,7 +335,6 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait,
   pid_t ChildPid = PI.Pid;
   if (WaitUntilTerminates) {
     SecondsToWait = 0;
-    ChildPid = -1; // mimic a wait() using waitpid()
   } else if (SecondsToWait) {
     // Install a timeout handler.  The handler itself does nothing, but the
     // simple fact of having a handler at all causes the wait below to return