* sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an error when

we can't duplicate from "parent" since it is probably ok if children of the
previous owner of the pid disappear.
This commit is contained in:
Christopher Faylor 2011-11-03 18:48:27 +00:00
parent 516fbf67a0
commit 277753c80e
2 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,9 @@
2011-11-03 Christopher Faylor <me.cygwin2011@cgf.cx>
* sigproc.cc (child_info_spawn::reattach_children): Avoid issuing an
error when we can't duplicate from "parent" since it is probably ok if
children of the previous owner of the pid disappear.
2011-11-03 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (off_current): Define local in fhandler_base::raw_write.

View File

@ -859,16 +859,15 @@ child_info_spawn::reattach_children ()
for (int i = 0; i < nchildren; i++)
{
pinfo p (children[i].pid, PID_MAP_RW);
if (p)
{
if (!DuplicateHandle (parent, children[i].rd_proc_pipe,
if (!p)
/* pid no longer exists */;
else if (!DuplicateHandle (parent, children[i].rd_proc_pipe,
GetCurrentProcess (), &p.rd_proc_pipe, 0,
false, DUPLICATE_SAME_ACCESS))
system_printf ("couldn't duplicate parent %p handles for forked children after exec, %E",
children[i].rd_proc_pipe);
p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid);
p.reattach ();
}
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 ();
}
}