summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-08-27 22:53:59 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-08-27 22:53:59 (GMT)
commitdaf455554bc21b6b5df0a016ab5fa639d36cc595 (patch)
tree216f52f9f6d9aed0406b2ce2574e5a02aa93e327 /Modules/mmapmodule.c
parent46e1ce214b5711e8dae63a1b5a0a7aafb371baf0 (diff)
downloadcpython-daf455554bc21b6b5df0a016ab5fa639d36cc595.zip
cpython-daf455554bc21b6b5df0a016ab5fa639d36cc595.tar.gz
cpython-daf455554bc21b6b5df0a016ab5fa639d36cc595.tar.bz2
Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(), os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
Diffstat (limited to 'Modules/mmapmodule.c')
-rw-r--r--Modules/mmapmodule.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
index 4b4be61..366dac1 100644
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1208,18 +1208,18 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
flags |= MAP_ANONYMOUS;
#else
/* SVR4 method to map anonymous memory is to open /dev/zero */
- fd = devzero = open("/dev/zero", O_RDWR);
+ fd = devzero = _Py_open("/dev/zero", O_RDWR);
if (devzero == -1) {
Py_DECREF(m_obj);
PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
#endif
- } else {
- m_obj->fd = dup(fd);
+ }
+ else {
+ m_obj->fd = _Py_dup(fd);
if (m_obj->fd == -1) {
Py_DECREF(m_obj);
- PyErr_SetFromErrno(PyExc_OSError);
return NULL;
}
}