diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2015-04-17 12:11:15 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2015-04-17 12:11:15 +0000 |
commit | 97de57343a1dadbd87e931d8506952fd01104d00 (patch) | |
tree | c716b40d6cb9717f46fa5cf04e4b31adee154233 | |
parent | bb60cfb5c4c9ad62c896e2a6431fe4efb0f53b10 (diff) | |
download | bcm5719-llvm-97de57343a1dadbd87e931d8506952fd01104d00.tar.gz bcm5719-llvm-97de57343a1dadbd87e931d8506952fd01104d00.zip |
Revert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.
Avoid double closing of the handle by testing GetLastErr for
ERROR_INVALID_HANDLE and not calling CloseHandle(PI.ProcessHandle) then.
llvm-svn: 235184
-rw-r--r-- | llvm/lib/Support/Windows/Program.inc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Windows/Program.inc b/llvm/lib/Support/Windows/Program.inc index 32602345f65..75685de4554 100644 --- a/llvm/lib/Support/Windows/Program.inc +++ b/llvm/lib/Support/Windows/Program.inc @@ -423,6 +423,7 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, return WaitResult; } WaitForSingleObject(PI.ProcessHandle, INFINITE); + CloseHandle(PI.ProcessHandle); } else { // Non-blocking wait. return ProcessInfo(); @@ -433,7 +434,8 @@ ProcessInfo sys::Wait(const ProcessInfo &PI, unsigned SecondsToWait, DWORD status; BOOL rc = GetExitCodeProcess(PI.ProcessHandle, &status); DWORD err = GetLastError(); - CloseHandle(PI.ProcessHandle); + if (err != ERROR_INVALID_HANDLE) + CloseHandle(PI.ProcessHandle); if (!rc) { SetLastError(err); |