From: GNU Libc Maintainers Date: Wed, 30 Apr 2025 01:01:35 +0000 (+0800) Subject: git-posix_openpt X-Git-Tag: archive/raspbian/2.31-13+rpi1+deb11u12^2~133 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2f5ff5426d426bc5d9ef86dfec317c4fd2d22443;p=glibc.git git-posix_openpt https://sourceware.org/ml/libc-alpha/2019-12/msg00799.html Committed for 2.33 Author: Samuel Thibault Rearrange bsd_getpt vs bsd_openpt and implement posix_openpt on BSD * sysdeps/unix/bsd/getpt.c (__getpt): Add oflag parameter, pass it to the _open call and rename to... (__bsd_openpt): ... new function. [!HAVE_GETPT] (__getpt): Reimplement on top of __bsd_openpt. (__posix_openpt): Replace stub with implementation on top of __bsd_openpt. (posix_openpt): Remove stub warning. Gbp-Pq: Topic hurd-i386 Gbp-Pq: Name git-posix_openpt.diff --- diff --git a/sysdeps/unix/bsd/getpt.c b/sysdeps/unix/bsd/getpt.c index 75489aef2..45c91005a 100644 --- a/sysdeps/unix/bsd/getpt.c +++ b/sysdeps/unix/bsd/getpt.c @@ -41,7 +41,7 @@ const char __libc_ptyname2[] attribute_hidden = PTYNAME2; /* Open a master pseudo terminal and return its file descriptor. */ int -__getpt (void) +__bsd_openpt (int oflag) { char buf[sizeof (_PATH_PTY) + 2]; const char *p, *q; @@ -61,7 +61,7 @@ __getpt (void) s[1] = *q; - fd = __open (buf, O_RDWR); + fd = __open (buf, oflag); if (fd != -1) return fd; @@ -74,18 +74,20 @@ __getpt (void) return -1; } -#undef __getpt +#ifndef HAVE_GETPT +int +__getpt (void) +{ + return __bsd_openpt (O_RDWR); +} weak_alias (__getpt, getpt) +#endif #ifndef HAVE_POSIX_OPENPT -/* We cannot define posix_openpt in general for BSD systems. */ int __posix_openpt (int oflag) { - __set_errno (ENOSYS); - return -1; + return __bsd_openpt (oflag); } weak_alias (__posix_openpt, posix_openpt) - -stub_warning (posix_openpt) #endif