summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJulien Lerouge <jlerouge@apple.com>2014-06-27 18:02:54 +0000
committerJulien Lerouge <jlerouge@apple.com>2014-06-27 18:02:54 +0000
commit86ebb340effcb5b8143bcf6e90e1c5186b3103d1 (patch)
tree59f2f2723b3bb2b04c62374bdb466fb99def00ea /lib
parent896cde882f7c6ccbbd4666ad301f9a1ba9f2131c (diff)
downloadllvm-86ebb340effcb5b8143bcf6e90e1c5186b3103d1.tar.gz
llvm-86ebb340effcb5b8143bcf6e90e1c5186b3103d1.tar.bz2
llvm-86ebb340effcb5b8143bcf6e90e1c5186b3103d1.tar.xz
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211918 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Support/Unix/Program.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Support/Unix/Program.inc b/lib/Support/Unix/Program.inc
index 50f973a850..06a33cd779 100644
--- a/lib/Support/Unix/Program.inc
+++ b/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.