[Python-checkins] r64944 - python/trunk/Modules/posixmodule.c

gregory.p.smith python-checkins at python.org
Mon Jul 14 08:06:48 CEST 2008


Author: gregory.p.smith
Date: Mon Jul 14 08:06:48 2008
New Revision: 64944

Log:
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.


Modified:
   python/trunk/Modules/posixmodule.c

Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Mon Jul 14 08:06:48 2008
@@ -3597,7 +3597,8 @@
 	pid_t pid = fork1();
 	if (pid == -1)
 		return posix_error();
-	PyOS_AfterFork();
+	if (pid == 0)
+		PyOS_AfterFork();
 	return PyInt_FromLong(pid);
 }
 #endif


More information about the Python-checkins mailing list