[llvm] 7fb7c78 - Support: Try to fix msan error in sys::Wait
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 14 11:09:39 PST 2022
Author: Matt Arsenault
Date: 2022-12-14T14:09:34-05:00
New Revision: 7fb7c78c46e23f7f8cacd501c1db685549294c41
URL: https://github.com/llvm/llvm-project/commit/7fb7c78c46e23f7f8cacd501c1db685549294c41
DIFF: https://github.com/llvm/llvm-project/commit/7fb7c78c46e23f7f8cacd501c1db685549294c41.diff
LOG: Support: Try to fix msan error in sys::Wait
Added:
Modified:
llvm/lib/Support/Unix/Program.inc
Removed:
################################################################################
diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc
index 7d451a7eb45a7..adfed226e6c1c 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.
More information about the llvm-commits
mailing list