summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/lib/Support/Windows/Program.inc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/lib/Support/Windows/Program.inc')
-rw-r--r--contrib/llvm/lib/Support/Windows/Program.inc3
1 files changed, 2 insertions, 1 deletions
diff --git a/contrib/llvm/lib/Support/Windows/Program.inc b/contrib/llvm/lib/Support/Windows/Program.inc
index c370077..75685de 100644
--- a/contrib/llvm/lib/Support/Windows/Program.inc
+++ b/contrib/llvm/lib/Support/Windows/Program.inc
@@ -434,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);
OpenPOWER on IntegriCloud