diff options
author | Julien Lerouge <jlerouge@apple.com> | 2014-06-27 18:02:54 +0000 |
---|---|---|
committer | Julien Lerouge <jlerouge@apple.com> | 2014-06-27 18:02:54 +0000 |
commit | a67d14f5a346fa6ad110bbdd4a9c3b87a3c08e4d (patch) | |
tree | 68830bbd1e14108c364949edbe06206937df289e /llvm/lib/Support/Unix/Program.inc | |
parent | d782d0566681de27782dd5cd175624a60f7b0644 (diff) | |
download | bcm5719-llvm-a67d14f5a346fa6ad110bbdd4a9c3b87a3c08e4d.tar.gz bcm5719-llvm-a67d14f5a346fa6ad110bbdd4a9c3b87a3c08e4d.zip |
lldb can interrupt waitpid, so EINTR shouldn't be an error. This fixes the case
where there is no timeout. In the case where there is a timeout though, the
code is still wrong since it doesn't check that the alarm really went off.
Without this patch, I cannot debug a program that forks itself using
sys::ExecuteAndWait with lldb.
llvm-svn: 211918
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Program.inc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc index 50f973a850b..06a33cd7790 100644 --- a/llvm/lib/Support/Unix/Program.inc +++ b/llvm/lib/Support/Unix/Program.inc @@ -350,7 +350,11 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, // Parent process: Wait for the child process to terminate. int status; ProcessInfo WaitResult; - WaitResult.Pid = waitpid(ChildPid, &status, WaitPidOptions); + + do { + WaitResult.Pid = waitpid(ChildPid, &status, WaitPidOptions); + } while (WaitUntilTerminates && WaitResult.Pid == -1 && errno == EINTR); + if (WaitResult.Pid != PI.Pid) { if (WaitResult.Pid == 0) { // Non-blocking wait. |