summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Modules/posixmodule.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 8f32fd4349..d8c81b6a58 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