diff options
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index b9304ff70..88b9bf21f 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -529,7 +529,8 @@ spawn_guts (const char *prog_arg, const char *const *argv, and before copying the datastructures to the child. So we have to start the child in suspend state, unfortunately, to avoid a race condition. */ if (!newargv.win16_exe - && (!ch.iscygwin () || mode != _P_OVERLAY)) + && (!ch.iscygwin () || mode != _P_OVERLAY + || cygheap->fdtab.need_fixup_before ())) c_flags |= CREATE_SUSPENDED; /* When ruid != euid we create the new process under the current original @@ -656,6 +657,11 @@ loop: if (!(c_flags & CREATE_SUSPENDED)) strace.write_childpid (ch, pi.dwProcessId); + /* Fixup the parent data structures if needed and resume the child's + main thread. */ + if (cygheap->fdtab.need_fixup_before ()) + cygheap->fdtab.fixup_before_exec (pi.dwProcessId); + if (mode != _P_OVERLAY) cygpid = cygwin_pid (pi.dwProcessId); else |