diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-31 23:08:23 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-31 23:08:23 (GMT) |
commit | 951cc0f474e4757e6954f0435952804211c5637c (patch) | |
tree | 4e04f1f90d551a9fdd8b6936b7523fae0ce0a0ee /Modules/posixmodule.c | |
parent | 105be7725b88ecef826ac07392a4236bae934bf6 (diff) | |
download | cpython-951cc0f474e4757e6954f0435952804211c5637c.zip cpython-951cc0f474e4757e6954f0435952804211c5637c.tar.gz cpython-951cc0f474e4757e6954f0435952804211c5637c.tar.bz2 |
Fixed bug #1983: Return from fork() is pid_t, not int
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0038703..8663c99 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -3575,11 +3575,11 @@ Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork1(PyObject *self, PyObject *noargs) { - int pid = fork1(); + pid_t pid = fork1(); if (pid == -1) return posix_error(); PyOS_AfterFork(); - return PyInt_FromLong((long)pid); + return PyInt_FromLong(pid); } #endif @@ -3593,12 +3593,12 @@ Return 0 to child process and PID of child to parent process."); static PyObject * posix_fork(PyObject *self, PyObject *noargs) { - int pid = fork(); + pid_t pid = fork(); if (pid == -1) return posix_error(); if (pid == 0) PyOS_AfterFork(); - return PyInt_FromLong((long)pid); + return PyInt_FromLong(pid); } #endif @@ -3700,14 +3700,15 @@ To both, return fd of newly opened pseudo-terminal.\n"); static PyObject * posix_forkpty(PyObject *self, PyObject *noargs) { - int master_fd = -1, pid; + int master_fd = -1; + pid_t pid; pid = forkpty(&master_fd, NULL, NULL, NULL); if (pid == -1) return posix_error(); if (pid == 0) PyOS_AfterFork(); - return Py_BuildValue("(ii)", pid, master_fd); + return Py_BuildValue("(li)", pid, master_fd); } #endif |