summaryrefslogtreecommitdiff
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-05-19 16:48:06 +0200
committerVictor Stinner <victor.stinner@gmail.com>2016-05-19 16:48:06 +0200
commit4a3443be43986c4b8c59a6127c04a44e5caf66f1 (patch)
tree85d243f950c23f7e24c2a5aa19b758243cab3d95 /Python/fileutils.c
parent99ab0068af4fbd0c3205ad3dfdd575e5f81deb3a (diff)
parent3116cc44af1de8f261f642baba50e254b5e1592d (diff)
downloadcpython-git-4a3443be43986c4b8c59a6127c04a44e5caf66f1.tar.gz
Merge 3.5 (issue #27057)
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 4a0ef48f12..e903f1f849 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -860,7 +860,7 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
return 0;
}
- if (errno != ENOTTY) {
+ if (errno != ENOTTY && errno != EACCES) {
if (raise)
PyErr_SetFromErrno(PyExc_OSError);
return -1;
@@ -869,7 +869,12 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
/* Issue #22258: Here, ENOTTY means "Inappropriate ioctl for
device". The ioctl is declared but not supported by the kernel.
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;
}
/* fallback to fcntl() if ioctl() does not work */