You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/08/19 00:22:55 UTC
svn commit: r432749 - /incubator/stdcxx/trunk/util/exec.cpp
Author: sebor
Date: Fri Aug 18 15:22:55 2006
New Revision: 432749
URL: http://svn.apache.org/viewvc?rev=432749&view=rev
Log:
2006-08-18 Andrew Black <ab...@roguewave.com>
* exec.cpp [_WIN32 || _WIN64] (exec_file): Check return value
from calls to CloseHandle and WaitForSingleObject.
Modified:
incubator/stdcxx/trunk/util/exec.cpp
Modified: incubator/stdcxx/trunk/util/exec.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/util/exec.cpp?rev=432749&r1=432748&r2=432749&view=diff
==============================================================================
--- incubator/stdcxx/trunk/util/exec.cpp (original)
+++ incubator/stdcxx/trunk/util/exec.cpp Fri Aug 18 15:22:55 2006
@@ -952,7 +952,8 @@
if (-1 == status.status)
return status;
- CloseHandle (child.hThread);
+ if (0 == CloseHandle (context.hThread))
+ warn_last_error ("Closing child main thread handle");
/* Wait for the child process to terminate */
wait_code = WaitForSingleObject (child.hProcess, real_timeout);
@@ -969,7 +970,8 @@
status.error = warn_last_error ("Waiting for child process");
}
- CloseHandle (child.hProcess);
+ if (0 == CloseHandle (context.hProcess))
+ warn_last_error ("Closing child process handle");
return status;
}
@@ -1010,21 +1012,24 @@
status.error = warn_last_error ("Waiting for child process");
}
- CloseHandle (child.hProcess);
+ if (0 == CloseHandle (context.hProcess))
+ warn_last_error ("Closing child process handle");
return status;
}
}
/* Then hard kill the child process */
if (0 == TerminateProcess (child.hProcess, 3))
warn_last_error ("Terminating child process");
- else
- WaitForSingleObject (child.hProcess, 1000);
+ else if (WAIT_FAIL == WaitForSingleObject (child.hProcess, 1000))
+ warn_last_error ("Waiting for child process");
+
if (0 == GetExitCodeProcess (child.hProcess, &status.status)) {
warn_last_error ("Retrieving child process exit code");
status.status = -1;
}
status.error = 3;
- CloseHandle (child.hProcess);
+ if (0 == CloseHandle (context.hProcess))
+ warn_last_error ("Closing child process handle");
return status;
}
#endif /* _WIN{32,64} */