mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
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().
This commit is contained in:
parent
46e1ce214b
commit
daf455554b
51 changed files with 1448 additions and 317 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue