aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-08-24 04:07:50 +0000
committerChristopher Faylor <me@cgf.cx>2000-08-24 04:07:50 +0000
commitf5589e41184c76a72991289c872b5a608e6a7731 (patch)
tree7174b6d2587fce223afb64d76a9744db389ec097 /winsup/cygwin/spawn.cc
parente1cf4ae80c43bd50e0e8f156d61d948d2947d295 (diff)
downloadnewlib-f5589e41184c76a72991289c872b5a608e6a7731.zip
newlib-f5589e41184c76a72991289c872b5a608e6a7731.tar.gz
newlib-f5589e41184c76a72991289c872b5a608e6a7731.tar.bz2
* dcrt0.cc (dll_crt0_1): Move exception list and constructor stuff earlier in
the process. Use new second argument to set_myself. (cygwin_dll_init): Initialize exception list and constructor stuff here. (_dll_crt0): And here. Also, deal with inherited pinfo shared memory region from parent. * pinfo.cc (set_myself): Accept a second argument signifying the a shared memory region, passed from an execing parent. (pinfo_init): Ditto. * pinfo.h: Ditto. * shared.h (child_info): Add a handle field to pass to child. * spawn.cc (spawn_guts): Create a shared handle to pass to an execed child. * winsup.h: Remove extraneous declaration.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 940f8d1..c9a9c3a 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -494,9 +494,13 @@ skip_arg_parsing:
}
init_child_info (chtype, ciresrv, (mode == _P_OVERLAY) ? myself->pid : 1, spr);
+ if (mode != _P_OVERLAY ||
+ !DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc,
+ &ciresrv->myself_pinfo, 0,
+ TRUE, DUPLICATE_SAME_ACCESS))
+ ciresrv->myself_pinfo = NULL;
LPBYTE resrv = si.lpReserved2 + sizeof *ciresrv;
-# undef ciresrv
if (fdtab.linearize_fd_array (resrv, len) < 0)
{
@@ -611,6 +615,9 @@ skip_arg_parsing:
free (envblock);
MALLOC_CHECK;
+ if (ciresrv->myself_pinfo)
+ CloseHandle (ciresrv->myself_pinfo);
+
/* Set errno now so that debugging messages from it appear before our
final debugging message [this is a general rule for debugging
messages]. */