diff options
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r-- | winsup/cygwin/fork.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index ac2e9ca5e..ea162519f 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -302,6 +302,13 @@ frok::parent (volatile char * volatile stack_here) else c_flags |= DETACHED_PROCESS; + /* Some file types (currently only sockets) need extra effort in the + parent after CreateProcess 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 (cygheap->fdtab.need_fixup_before ()) + c_flags |= CREATE_SUSPENDED; + /* Remember if we need to load dynamically linked dlls. We do this here so that this information will be available in the parent and, when the stack is copied, in the child. */ @@ -369,6 +376,12 @@ frok::parent (volatile char * volatile stack_here) goto cleanup; } + if (cygheap->fdtab.need_fixup_before ()) + { + cygheap->fdtab.fixup_before_fork (pi.dwProcessId); + ResumeThread (pi.hThread); + } + CloseHandle (pi.hThread); /* Protect the handle but name it similarly to the way it will |