summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-07-14 06:06:48 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-07-14 06:06:48 (GMT)
commitfb7a50fbb9d4728909382ba7f9eb65f2c0ab2d79 (patch)
tree866d7f75ae2726e6ed468326858db91b08c02045 /Modules/posixmodule.c
parent4ec0c27eea99ebeb20042d2cc61c5dfa29e4b043 (diff)
downloadcpython-fb7a50fbb9d4728909382ba7f9eb65f2c0ab2d79.zip
cpython-fb7a50fbb9d4728909382ba7f9eb65f2c0ab2d79.tar.gz
cpython-fb7a50fbb9d4728909382ba7f9eb65f2c0ab2d79.tar.bz2
Fix posix.fork1() / os.fork1() to only call PyOS_AfterFork() in the child
process rather than both parent and child. Does anyone actually use fork1()? It appears to be a Solaris thing but if Python is built with pthreads on Solaris, fork1() and fork() should be the same.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8f32fd4..d8c81b6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -3597,7 +3597,8 @@ posix_fork1(PyObject *self, PyObject *noargs)
pid_t pid = fork1();
if (pid == -1)
return posix_error();
- PyOS_AfterFork();
+ if (pid == 0)
+ PyOS_AfterFork();
return PyInt_FromLong(pid);
}
#endif