summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-07-14 22:15:12 +0000
committerChristopher Faylor <me@cgf.cx>2006-07-14 22:15:12 +0000
commitfbadc634cb3a805c94fd71d4136291b51784cd04 (patch)
tree84fca13db58b9dc1cbc687d06e58f4961abe75db /winsup/cygwin
parentd9ceecd2d2d8c94f21468325384975c7308ad899 (diff)
downloadcygnal-fbadc634cb3a805c94fd71d4136291b51784cd04.tar.gz
cygnal-fbadc634cb3a805c94fd71d4136291b51784cd04.tar.bz2
cygnal-fbadc634cb3a805c94fd71d4136291b51784cd04.zip
* fork.cc (fork): Lock the process before forking to prevent things like new
fds from being opened, etc. * sync.h (lock_process::dont_bother): New function.
Diffstat (limited to 'winsup/cygwin')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/fork.cc6
-rw-r--r--winsup/cygwin/sync.h1
3 files changed, 12 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a292b9537..cf8ac0a65 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2006-07-14 Christopher Faylor <cgf@timesys.com>
+ * fork.cc (fork): Lock the process before forking to prevent things
+ like new fds from being opened, etc.
+ * sync.h (lock_process::dont_bother): New function.
+
+2006-07-14 Christopher Faylor <cgf@timesys.com>
+
* include/cygwin/types.h: Update copyright.
2006-07-14 Christopher Faylor <cgf@timesys.com>
diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc
index 204362911..ed85e74cf 100644
--- a/winsup/cygwin/fork.cc
+++ b/winsup/cygwin/fork.cc
@@ -533,6 +533,7 @@ fork ()
return -1;
}
+ lock_process now;
if (sig_send (NULL, __SIGHOLD))
{
if (exit_state)
@@ -547,7 +548,10 @@ fork ()
__asm__ volatile ("movl %%esp,%0": "=r" (esp));
if (ischild)
- res = grouped.child (esp);
+ {
+ res = grouped.child (esp);
+ now.dont_bother ();
+ }
else
{
res = grouped.parent (esp);
diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h
index 8fd01df3a..f7ce7e1b4 100644
--- a/winsup/cygwin/sync.h
+++ b/winsup/cygwin/sync.h
@@ -50,6 +50,7 @@ class lock_process
static muto locker;
public:
static void init () {locker.init ("lock_process");}
+ void dont_bother () {skip_unlock = true;}
lock_process (bool exiting = false)
{
locker.acquire ();