summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/sigproc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/sigproc.cc')
-rw-r--r--winsup/cygwin/sigproc.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index e12c18012..46ef79e39 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -737,12 +737,23 @@ child_info::child_info (unsigned in_cb, child_info_types chtype)
if (chtype != PROC_SPAWN)
subproc_ready = CreateEvent (&sec_all, FALSE, FALSE, NULL);
sigproc_printf ("subproc_ready %p", subproc_ready);
+ cygheap = ::cygheap;
+ cygheap_max = ::cygheap_max;
+ dwProcessId = myself->dwProcessId;
+ /* Create an inheritable handle to pass to the child process. This will
+ allow the child to duplicate handles from the parent to itself. */
+ parent = NULL;
+ if (!DuplicateHandle (hMainProc, hMainProc, hMainProc, &parent, 0, TRUE,
+ DUPLICATE_SAME_ACCESS))
+ system_printf ("couldn't create handle to myself for child, %E");
}
child_info::~child_info ()
{
if (subproc_ready)
CloseHandle (subproc_ready);
+ if (parent)
+ CloseHandle (parent);
}
child_info_fork::child_info_fork () :