diff options
author | Christopher Faylor <me@cgf.cx> | 2011-11-03 22:48:27 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2011-11-03 22:48:27 +0400 |
commit | 277753c80ef24b5a9e94ee7fb2962944cfd7d938 (patch) | |
tree | 5e4308570db94ce49b05e9b3f1f30db660429e1e /winsup/cygwin/sigproc.cc | |
parent | 516fbf67a0f6882e592029d69f7b632736cfee0a (diff) |
* 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.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r-- | winsup/cygwin/sigproc.cc | 15 |
1 files changed, 7 insertions, 8 deletions
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 (); } } |