aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Unix/Program.inc
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2022-12-14 14:09:09 -0500
committerMatt Arsenault <Matthew.Arsenault@amd.com>2022-12-14 14:09:34 -0500
commit7fb7c78c46e23f7f8cacd501c1db685549294c41 (patch)
treea94619a75abd2e1a6d9dc85ef1962cd99964f4d1 /llvm/lib/Support/Unix/Program.inc
parenta0220ba7218f0331986f0595662342ecfd173d92 (diff)
downloadllvm-7fb7c78c46e23f7f8cacd501c1db685549294c41.zip
llvm-7fb7c78c46e23f7f8cacd501c1db685549294c41.tar.gz
llvm-7fb7c78c46e23f7f8cacd501c1db685549294c41.tar.bz2
Support: Try to fix msan error in sys::Wait
Diffstat (limited to 'llvm/lib/Support/Unix/Program.inc')
-rw-r--r--llvm/lib/Support/Unix/Program.inc7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 7d451a7..adfed22 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -396,7 +396,10 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
bool WaitUntilTerminates = false;
if (!SecondsToWait) {
WaitUntilTerminates = true;
- } else if (*SecondsToWait != 0) {
+ } else {
+ if (*SecondsToWait == 0)
+ WaitPidOptions = WNOHANG;
+
// 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
// with EINTR, unlike if we used SIG_IGN.
@@ -407,8 +410,6 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
// FIXME The alarm signal may be delivered to another thread.
alarm(*SecondsToWait);
- } else {
- WaitPidOptions = WNOHANG;
}
// Parent process: Wait for the child process to terminate.