From 25e40ae6aa4b51f08c60bab3d11bb28a9efc2847 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 14 Sep 2001 04:37:57 +0000 Subject: [PATCH] * fork.cc (vfork): Avoid recursive vforks. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/fork.cc | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index ddf8cd82d..299b0d635 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +Fri Sep 14 00:37:54 2001 Christopher Faylor + + * fork.cc (vfork): Avoid recursive vforks. + Fri Sep 14 00:18:52 2001 Christopher Faylor * fhandler.h (fhandler_pipe::is_slow): Return true only if pipes are diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 83e25393f..b2f4d7c84 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -705,6 +705,8 @@ vfork () if (vf == NULL) vf = vfork_storage.create (); + else if (vf->pid) + return fork (); if (!setjmp (vf->j)) { @@ -735,6 +737,8 @@ vfork () exit (exitval); } - return vf->pid; + int pid = vf->pid; + vf->pid = 0; + return pid; #endif }