Skip to content

Commit 3d20955

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

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
@@ -8618,7 +8618,9 @@ os_posix_openpt_impl(PyObject *module, int oflag)
86188618
{
86198619
int fd;
86208620

8621-
#if defined(O_CLOEXEC)
8621+
// OpenBSD posix_openpt() rejects any flag other than O_RDWR and
8622+
// O_NOCTTY; the fd is made non-inheritable below in any case.
8623+
#if defined(O_CLOEXEC) && !defined(__OpenBSD__)
86228624
oflag |= O_CLOEXEC;
86238625
#endif
86248626

0 commit comments

Comments
 (0)