[llvm] r235184 - Revert r235177 as the Handle is used to fail GetExitCodeProcess on purpose.
Yaron Keren
yaron.keren at gmail.com
Fri Apr 17 05:11:15 PDT 2015
Author: yrnkrn
Date: Fri Apr 17 07:11:15 2015
New Revision: 235184
URL: http://llvm.org/viewvc/llvm-project?rev=235184&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Support/Windows/Program.inc
Modified: llvm/trunk/lib/Support/Windows/Program.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Program.inc?rev=235184&r1=235183&r2=235184&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/Program.inc (original)
+++ llvm/trunk/lib/Support/Windows/Program.inc Fri Apr 17 07:11:15 2015
@@ -423,6 +423,7 @@ ProcessInfo sys::Wait(const ProcessInfo
return WaitResult;
}
WaitForSingleObject(PI.ProcessHandle, INFINITE);
+ CloseHandle(PI.ProcessHandle);
} else {
// Non-blocking wait.
return ProcessInfo();
@@ -433,7 +434,8 @@ ProcessInfo sys::Wait(const ProcessInfo
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);
More information about the llvm-commits
mailing list