Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-02-10 07:20:52 +0300
committerChristopher Faylor <me@cgf.cx>2001-02-10 07:20:52 +0300
commitcde0c2fbcaac1f78efc607475f6f4bed37e25cfc (patch)
tree6e60d15e6899611af43fe6f2ff618bf933bf5cc7 /winsup/cygwin/fork.cc
parent1e667f61b72db0e8ae2a0f7f037f1824c39aeaf3 (diff)
* fork.cc (fork_parent): Return EAGAIN when can't record pid.
* pinfo.h (pinfo::remember): Return value of call to proc_subproc. * sigproc.cc (proc_subproc): Return error if can't record pid.
Diffstat (limited to 'winsup/cygwin/fork.cc')
-rw-r--r--winsup/cygwin/fork.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 7e8ad534f..8a1daf7e6 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -514,13 +514,24 @@ out:
be called in subproc handling. */
ProtectHandle1 (pi.hProcess, childhProc);
- slow_pid_reuse (pi.hProcess);
-
/* Fill in fields in the child's process table entry. */
forked->hProcess = pi.hProcess;
forked->dwProcessId = pi.dwProcessId;
forked->copysigs(myself);
- forked.remember ();
+
+ /* Hopefully, this will succeed. The alternative to doing things this
+ way is to reserve space prior to calling CreateProcess and then fill
+ it in afterwards. This requires more bookkeeping than I like, though,
+ so we'll just do it the easy way. So, terminate any child process if
+ we can't actually record the pid in the internal table. */
+ if (!forked.remember ())
+ {
+ TerminateProcess (pi.hProcess, 1);
+ set_errno (EAGAIN);
+ goto cleanup;
+ }
+
+ slow_pid_reuse (pi.hProcess);
/* Wait for subproc to initialize itself. */
if (!sync_with_child(pi, subproc_ready, TRUE, "waiting for longjmp"))