* pinfo.h (pinfo::reattach): Only set destroy to false when proc_subproc

succeeds.  Return true for success.
* sigproc.cc (child_info_spawn::reattach_children): Try harder to clean up on
error by detecting reattach failures too.
This commit is contained in:
Christopher Faylor
2011-11-04 17:07:21 +00:00
parent 705d704153
commit 26601df44c
3 changed files with 17 additions and 6 deletions

View File

@@ -866,10 +866,13 @@ child_info_spawn::reattach_children ()
false, DUPLICATE_SAME_ACCESS))
debug_printf ("couldn't duplicate parent %p handles for forked children after exec, %E",
children[i].rd_proc_pipe);
else if ((p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid)))
p.reattach ();
else
else if (!(p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid)))
CloseHandle (p.rd_proc_pipe);
else if (!p.reattach ())
{
CloseHandle (p.hProcess);
CloseHandle (p.rd_proc_pipe);
}
}
}