# HG changeset patch # User Bruno Haible # Date 1293301107 -3600 # Node ID 1adb3647af8f2cfc6c8a06715818b08e15a89061 # Parent 01400c528402631508dbaae46ce54a1dea6b6d7f ptsname test: Avoid failure on Solaris. * tests/test-ptsname.c (main): For Solaris, use the recommended way to open a pseudo-terminal; don't use BSD-style ptys. * doc/posix-functions/ptsname.texi: Document the limitation on Solaris. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-25 Bruno Haible + + ptsname test: Avoid failure on Solaris. + * tests/test-ptsname.c (main): For Solaris, use the recommended way to + open a pseudo-terminal; don't use BSD-style ptys. + * doc/posix-functions/ptsname.texi: Document the limitation on Solaris. + 2010-12-25 Bruno Haible ptsname: Avoid ERANGE failure on some systems. diff --git a/doc/posix-functions/ptsname.texi b/doc/posix-functions/ptsname.texi --- a/doc/posix-functions/ptsname.texi +++ b/doc/posix-functions/ptsname.texi @@ -15,4 +15,7 @@ Portability problems not fixed by Gnulib: @itemize +@item +On Solaris 11 2010-11, this function fails on all BSD-style @file{/dev/pty*} +device files. @end itemize diff --git a/tests/test-ptsname.c b/tests/test-ptsname.c --- a/tests/test-ptsname.c +++ b/tests/test-ptsname.c @@ -77,6 +77,30 @@ close (fd); } +#if defined __sun + /* Solaris has BSD-style /dev/pty[p-r][0-9a-f] files, but the function + ptsname() does not work on them. */ + { + int fd; + char *result; + + /* Open the controlling tty of the current process. */ + fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY); + if (fd < 0) + { + fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n"); + return 77; + } + + result = ptsname (fd); + ASSERT (result != NULL); + ASSERT (memcmp (result, "/dev/pts/", 9) == 0); + + close (fd); + } + +#else + /* Try various master names of MacOS X: /dev/pty[p-w][0-9a-f] */ { int char1; @@ -135,5 +159,7 @@ } } +#endif + return 0; }