gh-116622: Don't expose FICLONE ioctl on Android (#122522)

Don't expose `FICLONE` ioctl on Android

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
This commit is contained in:
Malcolm Smith 2024-08-01 01:23:10 +01:00 committed by GitHub
parent 8844197daa
commit 06656e259b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,2 @@
On Android, the ``FICLONE`` and ``FICLONERANGE`` constants are no longer
exposed by :mod:`fcntl`, as these ioctls are blocked by SELinux.

View File

@ -580,12 +580,17 @@ all_ins(PyObject* m)
#ifdef F_GETPIPE_SZ
if (PyModule_AddIntMacro(m, F_GETPIPE_SZ)) return -1;
#endif
/* On Android, FICLONE is blocked by SELinux. */
#ifndef __ANDROID__
#ifdef FICLONE
if (PyModule_AddIntMacro(m, FICLONE)) return -1;
#endif
#ifdef FICLONERANGE
if (PyModule_AddIntMacro(m, FICLONERANGE)) return -1;
#endif
#endif
#ifdef F_GETOWN_EX
// since Linux 2.6.32
if (PyModule_AddIntMacro(m, F_GETOWN_EX)) return -1;