mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-44849: Fix os.set_inheritable() on FreeBSD 14 with O_PATH (GH-27623)
Fix the os.set_inheritable() function on FreeBSD 14 for file
descriptor opened with the O_PATH flag: ignore the EBADF error on
ioctl(), fallback on the fcntl() implementation.
(cherry picked from commit c24896c0e3
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
a11158ecef
commit
2ae2235c7a
2 changed files with 8 additions and 3 deletions
|
@ -0,0 +1,4 @@
|
|||
Fix the :func:`os.set_inheritable` function on FreeBSD 14 for file descriptor
|
||||
opened with the :data:`~os.O_PATH` flag: ignore the :data:`~errno.EBADF`
|
||||
error on ``ioctl()``, fallback on the ``fcntl()`` implementation. Patch by
|
||||
Victor Stinner.
|
|
@ -1374,10 +1374,11 @@ set_inheritable(int fd, int inheritable, int raise, int *atomic_flag_works)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
#ifdef O_PATH
|
||||
if (errno == EBADF) {
|
||||
// On Linux, ioctl(FIOCLEX) will fail with EBADF for O_PATH file descriptors
|
||||
// Fall through to the fcntl() path
|
||||
// bpo-44849: On Linux and FreeBSD, ioctl(FIOCLEX) fails with EBADF
|
||||
// on O_PATH file descriptors. Fall through to the fcntl()
|
||||
// implementation.
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue