Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2011-11-04 21:07:21 +0400
committerChristopher Faylor <me@cgf.cx>2011-11-04 21:07:21 +0400
commit26601df44c0d70a74e882f7ca0262220d1e9c382 (patch)
tree64391c16531790927f9f6e611a57daf2773adabe /winsup/cygwin/sigproc.cc
parent705d704153cf2352205b7f481473971f9eda8073 (diff)
* 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.
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index a3035d9ca..be570c496 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -866,10 +866,13 @@ child_info_spawn::reattach_children ()
false, DUPLICATE_SAME_ACCESS))
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 ();
- else
+ else if (!(p.hProcess = OpenProcess (PROCESS_QUERY_INFORMATION, false, p->pid)))
CloseHandle (p.rd_proc_pipe);
+ else if (!p.reattach ())
+ {
+ CloseHandle (p.hProcess);
+ CloseHandle (p.rd_proc_pipe);
+ }
}
}