diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 02:31:33 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2010-03-01 02:31:33 (GMT) |
commit | 4b862365c865ac9859ee63bd50c6f54bd94441c9 (patch) | |
tree | e3d45805ae7004e97eb4fd1d37d4edda9c6af4bf /Modules | |
parent | e6390a15033b9a93d345338d06b220542687b3fd (diff) | |
download | cpython-4b862365c865ac9859ee63bd50c6f54bd94441c9.zip cpython-4b862365c865ac9859ee63bd50c6f54bd94441c9.tar.gz cpython-4b862365c865ac9859ee63bd50c6f54bd94441c9.tar.bz2 |
Fix for r78527. It left out updating forkpty.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/posixmodule.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 45128d3..26c6e46 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3762,15 +3762,18 @@ To both, return fd of newly opened pseudo-terminal.\n"); static PyObject * posix_forkpty(PyObject *self, PyObject *noargs) { - int master_fd = -1, result; + int master_fd = -1, result = 0; pid_t pid; _PyImport_AcquireLock(); pid = forkpty(&master_fd, NULL, NULL, NULL); - if (pid == 0) + if (pid == 0) { + /* child: this clobbers and resets the import lock. */ PyOS_AfterFork(); - - result = _PyImport_ReleaseLock(); + } else { + /* parent: release the import lock. */ + result = _PyImport_ReleaseLock(); + } if (pid == -1) return posix_error(); if (result < 0) { |