mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
Fix os.set_inheritable() on Android
Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by SELinux and fails with EACCESS. The function now falls back to fcntl(). Patch written by Michał Bednarski.
This commit is contained in:
parent
4962141804
commit
3116cc44af
3 changed files with 12 additions and 2 deletions
|
@ -110,6 +110,7 @@ Neal Becker
|
||||||
Robin Becker
|
Robin Becker
|
||||||
Torsten Becker
|
Torsten Becker
|
||||||
Bill Bedford
|
Bill Bedford
|
||||||
|
Michał Bednarski
|
||||||
Ian Beer
|
Ian Beer
|
||||||
Stefan Behnel
|
Stefan Behnel
|
||||||
Reimer Behrends
|
Reimer Behrends
|
||||||
|
|
|
@ -123,6 +123,10 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #27057: Fix os.set_inheritable() on Android, ioctl() is blocked by
|
||||||
|
SELinux and fails with EACCESS. The function now falls back to fcntl().
|
||||||
|
Patch written by Michał Bednarski.
|
||||||
|
|
||||||
- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure!
|
- Issue #27014: Fix infinite recursion using typing.py. Thanks to Kalle Tuure!
|
||||||
|
|
||||||
- Issue #14132: Fix urllib.request redirect handling when the target only has
|
- Issue #14132: Fix urllib.request redirect handling when the target only has
|
||||||
|
|
|
@ -856,7 +856,7 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno != ENOTTY) {
|
if (errno != ENOTTY && errno != EACCES) {
|
||||||
if (raise)
|
if (raise)
|
||||||
PyErr_SetFromErrno(PyExc_OSError);
|
PyErr_SetFromErrno(PyExc_OSError);
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -865,7 +865,12 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
|
||||||
/* Issue #22258: Here, ENOTTY means "Inappropriate ioctl for
|
/* Issue #22258: Here, ENOTTY means "Inappropriate ioctl for
|
||||||
device". The ioctl is declared but not supported by the kernel.
|
device". The ioctl is declared but not supported by the kernel.
|
||||||
Remember that ioctl() doesn't work. It is the case on
|
Remember that ioctl() doesn't work. It is the case on
|
||||||
Illumos-based OS for example. */
|
Illumos-based OS for example.
|
||||||
|
|
||||||
|
Issue #27057: When SELinux policy disallows ioctl it will fail
|
||||||
|
with EACCES. While FIOCLEX is safe operation it may be
|
||||||
|
unavailable because ioctl was denied altogether.
|
||||||
|
This can be the case on Android. */
|
||||||
ioctl_works = 0;
|
ioctl_works = 0;
|
||||||
}
|
}
|
||||||
/* fallback to fcntl() if ioctl() does not work */
|
/* fallback to fcntl() if ioctl() does not work */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue