diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index bb091f06c..493fa80e1 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2011-11-03 Christopher Faylor + + * 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 * fhandler.cc (off_current): Define local in fhandler_base::raw_write. diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index fc5f816f4..fda9bc014 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -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 (); } }