]> Savannah Git Hosting - gnulib.git/commitdiff
ptsname_r: Work around ptsname_r bug on Solaris 11 OmniOS.
authorCollin Funk <collin.funk1@gmail.com>
Sat, 25 Jan 2025 05:36:11 +0000 (21:36 -0800)
committerCollin Funk <collin.funk1@gmail.com>
Sat, 25 Jan 2025 05:36:11 +0000 (21:36 -0800)
* lib/ptsname_r.c (ptsname_r): Ensure the resulting buffer is not
clobbered if it is too small on Solaris 11 OmniOS.
* m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): On Solaris 11 OmniOS, arrange to
override ptsname_r.
* doc/posix-functions/ptsname_r.texi: Document the bug.

ChangeLog
doc/posix-functions/ptsname_r.texi
lib/ptsname_r.c
m4/ptsname_r.m4

index 6f3cd5d7f0113028383ce6950b3c3cbeb49e5580..e909e9abcf3e70c0ec56f0a95a63b9ee415f062c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2025-01-24  Collin Funk  <collin.funk1@gmail.com>
 
+       ptsname_r: Work around ptsname_r bug on Solaris 11 OmniOS.
+       * lib/ptsname_r.c (ptsname_r): Ensure the resulting buffer is not
+       clobbered if it is too small on Solaris 11 OmniOS.
+       * m4/ptsname_r.m4 (gl_FUNC_PTSNAME_R): On Solaris 11 OmniOS, arrange to
+       override ptsname_r.
+       * doc/posix-functions/ptsname_r.texi: Document the bug.
+
        strerrorname_np: Work around a bug on Solaris 11 OmniOS.
        * m4/strerrorname_np.m4 (gl_CHECK_STRERRORNAME_NP): Test if
        strerrorname_np returns NULL when given ERESTART or ESTRPIPE.
index 1b50cc1378eea28319bbc3ede2d4edc7d980a502..5237f6a3788d04064ab6100796a4706e49f830ed 100644 (file)
@@ -34,7 +34,7 @@ macOS 14, FreeBSD 14.0, Android 4.3.
 @item
 When this function fails with ERANGE, it stores an empty string as result
 on some platforms:
-NetBSD 10.0.
+NetBSD 10.0, Solaris 11 OmniOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
index e2d90590882ef35227451dae3c65746b5b6519b1..3452afb8448186daf338ea749d8f18dea2ccaed4 100644 (file)
@@ -68,7 +68,7 @@ ptsname_r (int fd, char *buf, size_t buflen)
 #undef ptsname_r
 {
 #if HAVE_ESSENTIALLY_WORKING_PTSNAME_R
-# if defined __NetBSD__
+# if defined __NetBSD__ || defined __sun
   char tmpbuf[32];
   if (buf == NULL)
     return EINVAL;
index 36409fddf74ceb5c32cb0ab7e6f29b784a4e81ef..5cd6f91a07833de5701460dc4ca90953ae449d0f 100644 (file)
@@ -1,5 +1,5 @@
 # ptsname_r.m4
-# serial 10
+# serial 11
 dnl Copyright (C) 2010-2025 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -79,8 +79,10 @@ main (void)
       dnl result buffer. We don't use an AC_RUN_IFELSE test here, because
       dnl while the bug exists on all platforms, only NetBSD/i386 has the
       dnl files /dev/ptyp[01] on which the bug becomes apparent.
+      dnl
+      dnl On Solaris 11 OmniOS the result buffer is clobbered as well.
       case "$host_os" in
-        netbsd*) REPLACE_PTSNAME_R=1 ;;
+        netbsd* | solaris*) REPLACE_PTSNAME_R=1 ;;
       esac
     fi
   fi