From 277753c80ef24b5a9e94ee7fb2962944cfd7d938 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 3 Nov 2011 18:48:27 +0000 Subject: * 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. --- winsup/cygwin/sigproc.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'winsup/cygwin/sigproc.cc') 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 (); } } -- cgit v1.2.3