dTHX;
HANDLE hProcess;
long child;
+ int retval;
#ifdef USE_ITHREADS
if (pid < 0) {
/* it is a pseudo-forked child */
}
else {
alien_process:
+ retval = -1;
hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE,
(IsWin95() ? -pid : pid));
if (hProcess) {
switch(sig) {
case 0:
/* "Does process exist?" use of kill */
- return 0;
+ retval = 0;
+ break;
case 2:
if (GenerateConsoleCtrlEvent(CTRL_C_EVENT,pid))
- return 0;
+ retval = 0;
break;
default: /* For now be backwards compatible with perl5.6 */
case 9:
- if (TerminateProcess(hProcess, sig)) {
- CloseHandle(hProcess);
- return 0;
- }
+ if (TerminateProcess(hProcess, sig))
+ retval = 0;
+ break;
}
}
+ CloseHandle(hProcess);
+ if (retval == 0)
+ return 0;
}
}
errno = EINVAL;
if (hProcess) {
win32_msgwait(aTHX_ 1, &hProcess, timeout, &waitcode);
if (waitcode == WAIT_TIMEOUT) {
+ CloseHandle(hProcess);
return 0;
}
else if (waitcode == WAIT_OBJECT_0) {