* 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:
parent
705d704153
commit
26601df44c
|
@ -1,3 +1,10 @@
|
||||||
|
2011-11-04 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2011-11-04 Christopher Faylor <me.cygwin2011@cgf.cx>
|
2011-11-04 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* sigproc.cc (child_info_spawn::reattach_children): Clean up handle
|
* sigproc.cc (child_info_spawn::reattach_children): Clean up handle
|
||||||
|
|
|
@ -175,10 +175,11 @@ public:
|
||||||
#ifndef _SIGPROC_H
|
#ifndef _SIGPROC_H
|
||||||
int remember () {system_printf ("remember is not here"); return 0;}
|
int remember () {system_printf ("remember is not here"); return 0;}
|
||||||
#else
|
#else
|
||||||
void reattach ()
|
int reattach ()
|
||||||
{
|
{
|
||||||
proc_subproc (PROC_REATTACH_CHILD, (DWORD) this);
|
int res = proc_subproc (PROC_REATTACH_CHILD, (DWORD) this);
|
||||||
destroy = false;
|
destroy = res ? false : true;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
int remember (bool detach)
|
int remember (bool detach)
|
||||||
{
|
{
|
||||||
|
|
|
@ -866,10 +866,13 @@ child_info_spawn::reattach_children ()
|
||||||
false, DUPLICATE_SAME_ACCESS))
|
false, DUPLICATE_SAME_ACCESS))
|
||||||
debug_printf ("couldn't duplicate parent %p handles for forked children after exec, %E",
|
debug_printf ("couldn't duplicate parent %p handles for forked children after exec, %E",
|
||||||
children[i].rd_proc_pipe);
|
children[i].rd_proc_pipe);
|
||||||
else if ((p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid)))
|
else if (!(p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid)))
|
||||||
p.reattach ();
|
|
||||||
else
|
|
||||||
CloseHandle (p.rd_proc_pipe);
|
CloseHandle (p.rd_proc_pipe);
|
||||||
|
else if (!p.reattach ())
|
||||||
|
{
|
||||||
|
CloseHandle (p.hProcess);
|
||||||
|
CloseHandle (p.rd_proc_pipe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue