Skip to content

Commit 1fad2bb

Browse files
miss-islingtonserhiy-storchakaclaude
authored
[3.14] gh-154227: Fix os.posix_openpt() on OpenBSD (GH-154228) (GH-154236)
(cherry picked from commit d01b90c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d7efdf0 commit 1fad2bb

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix :func:`os.posix_openpt` on OpenBSD, where it rejected the
2+
:data:`~os.O_CLOEXEC` flag.

Modules/posixmodule.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8715,7 +8715,9 @@ os_posix_openpt_impl(PyObject *module, int oflag)
87158715
{
87168716
int fd;
87178717

8718-
#if defined(O_CLOEXEC)
8718+
// OpenBSD posix_openpt() rejects any flag other than O_RDWR and
8719+
// O_NOCTTY; the fd is made non-inheritable below in any case.
8720+
#if defined(O_CLOEXEC) && !defined(__OpenBSD__)
87198721
oflag |= O_CLOEXEC;
87208722
#endif
87218723

0 commit comments

Comments
 (0)