diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2006-12-05 13:59:21 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2006-12-05 13:59:21 +0300 |
commit | c6674b53d3b910b8d3dd4095d626e554b5c32fa1 (patch) | |
tree | f5230c3705aecf055c5210f469208ae72c9c36a2 /winsup/cygwin/spawn.cc | |
parent | 489bb390ceff00454f0f904c8c96cd39405918c6 (diff) |
* dcrt0.cc (get_cygwin_startup_info): Change zeros to DWORD array.
Expect first DWORD in child_info struct being set to non-zero if
wincap.needs_count_in_si_lpres2 is set. Add comment to explain why.
* fork.cc (frok::parent): Set ch.zero[0] to a sensible count value
if wincap.needs_count_in_si_lpres2 is set.
* spawn.cc (spawn_guts): Ditto. Add filler bytes after ch on stack
to accomodate needs_count_in_si_lpres2.
* wincap.h: Define needs_count_in_si_lpres2 throughout.
* wincap.cc: Ditto.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index d1750f744..12418df92 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -298,7 +298,13 @@ spawn_guts (const char * prog_arg, const char *const *argv, pthread_cleanup_push (do_cleanup, (void *) &cleanup); av newargv; linebuf one_line; - child_info_spawn ch; + /* Allocate slightly bigger for call to CreateProcess to accomodate + needs_count_in_si_lpres2. */ + struct { + child_info_spawn ch; + char filler[4]; + } _ch; +#define ch _ch.ch char *envblock = NULL; path_conv real_path; @@ -481,6 +487,10 @@ spawn_guts (const char * prog_arg, const char *const *argv, si.lpReserved2 = (LPBYTE) &ch; si.cbReserved2 = sizeof (ch); + /* See comment in dcrt0.cc, function get_cygwin_startup_info. */ + if (wincap.needs_count_in_si_lpres2 ()) + ch.zero[0] = sizeof (ch) / 5; + /* When ruid != euid we create the new process under the current original account and impersonate in child, this way maintaining the different effective vs. real ids. @@ -724,6 +734,7 @@ out: free (envblock); pthread_cleanup_pop (1); return (int) res; +#undef ch } extern "C" int |