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:
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index c9a76d85f..05d98729f 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -445,9 +445,17 @@ proc_terminate ()
/* Clean out proc processes from the pid list. */
for (int i = 0; i < nprocs; i++)
{
- procs[i]->ppid = 1;
+ /* If we've execed then the execed process will handle setting ppid
+ to 1 iff it is a Cygwin process. */
+ if (!have_execed || !have_execed_cygwin)
+ procs[i]->ppid = 1;
if (procs[i].wait_thread)
procs[i].wait_thread->terminate_thread ();
+ /* Release memory associated with this process unless it is 'myself'.
+ 'myself' is only in the procs table when we've execed. We reach
+ here when the next process has finished initializing but we still
+ can't free the memory used by 'myself' since it is used later on
+ during cygwin tear down. */
if (procs[i] != myself)
procs[i].release ();
}