aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/sigproc.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index f46d3d0..aa946fb 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -299,8 +299,10 @@ proc_subproc (DWORD what, uintptr_t val)
goto scan_wait;
case PROC_EXEC_CLEANUP:
+ /* Cleanup backwards to eliminate redundant copying of chld_procs
+ array members inside remove_proc. */
while (chld_procs.count ())
- remove_proc (0);
+ remove_proc (chld_procs.count () - 1);
for (w = &waitq_head; w->next != NULL; w = w->next)
CloseHandle (w->next->ev);
break;