Skip to content

Commit 06656e2

Browse files
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>
1 parent 8844197 commit 06656e2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
On Android, the ``FICLONE`` and ``FICLONERANGE`` constants are no longer
2+
exposed by :mod:`fcntl`, as these ioctls are blocked by SELinux.

Modules/fcntlmodule.c

+5
Original file line numberDiff line numberDiff line change
@@ -580,12 +580,17 @@ all_ins(PyObject* m)
580580
#ifdef F_GETPIPE_SZ
581581
if (PyModule_AddIntMacro(m, F_GETPIPE_SZ)) return -1;
582582
#endif
583+
584+
/* On Android, FICLONE is blocked by SELinux. */
585+
#ifndef __ANDROID__
583586
#ifdef FICLONE
584587
if (PyModule_AddIntMacro(m, FICLONE)) return -1;
585588
#endif
586589
#ifdef FICLONERANGE
587590
if (PyModule_AddIntMacro(m, FICLONERANGE)) return -1;
588591
#endif
592+
#endif
593+
589594
#ifdef F_GETOWN_EX
590595
// since Linux 2.6.32
591596
if (PyModule_AddIntMacro(m, F_GETOWN_EX)) return -1;

0 commit comments

Comments
 (0)