From e943a1a37ee4febeb856c39d03e6d38692f6a3e6 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Thu, 1 Mar 2007 18:43:38 +0000 Subject: [PATCH] * fork.cc (fork): Reset child to true after fork since it may have been reset by fork memory copies. --- winsup/cygwin/ChangeLog | 5 +++++ winsup/cygwin/fork.cc | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 00ee93c78..64c15988e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2007-03-01 Christopher Faylor + + * fork.cc (fork): Reset child to true after fork since it may have been + reset by fork memory copies. + 2007-03-01 Christopher Faylor * Makefile (DLL_OFILES): Remove ntea.o diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index dc59e4f70..e1b546d97 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -94,6 +94,7 @@ public: class hold_everything { +public: /* DELETEME*/ bool& ischild; /* Note the order of the locks below. It is important, to avoid races, that the lock order be preserved. @@ -620,11 +621,13 @@ fork () volatile char * volatile esp; __asm__ volatile ("movl %%esp,%0": "=r" (esp)); - if (!ischild) res = grouped.parent (esp); else - res = grouped.child (esp); + { + res = grouped.child (esp); + ischild = true; /* might have been reset by fork mem copy */ + } } MALLOC_CHECK;