summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-06-25 01:00:57 +0200
committerBruno Haible <bruno@clisp.org>2012-06-25 01:00:57 +0200
commitd9200335a44aaf4ab8eff5c57c564dd1f2d6c46e (patch)
tree3cbe8b517e7b93f93b685cec9ceb77fffb1aa1e5 /tests
parentd46c27a98eb3a11b60fdf76107ab96487d747ef2 (diff)
downloadgnulib-d9200335a44aaf4ab8eff5c57c564dd1f2d6c46e.tar.gz
ptsname_r: Make it consistent with ptsname on AIX.
* lib/ptsname_r.c (__ptsname_r): For AIX, use nearly the same implementation as for OSF/1. * tests/test-ptsname_r.c (main) [AIX]: Use the modern way of opening a pty master.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-ptsname_r.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c
index edb5e3d9d0..45ae8f05e9 100644
--- a/tests/test-ptsname_r.c
+++ b/tests/test-ptsname_r.c
@@ -151,7 +151,7 @@ main (void)
char buffer[256];
int result;
- /* Open the controlling tty of the current process. */
+ /* Open a pty master. */
fd = open ("/dev/ptmx", O_RDWR | O_NOCTTY);
if (fd < 0)
{
@@ -168,6 +168,32 @@ main (void)
close (fd);
}
+#elif defined _AIX
+ /* AIX has BSD-style /dev/ptyp[0-9a-f] files, but the modern way to open
+ a pty is to go through /dev/ptc. */
+ {
+ int fd;
+ char buffer[256];
+ int result;
+
+ /* Open a pty master. */
+ fd = open ("/dev/ptc", O_RDWR | O_NOCTTY);
+ if (fd < 0)
+ {
+ fprintf (stderr, "Skipping test: cannot open pseudo-terminal\n");
+ return 77;
+ }
+
+ result = ptsname_r (fd, buffer, sizeof buffer);
+ ASSERT (result == 0);
+ ASSERT (memcmp (buffer, "/dev/pts/", 9) == 0);
+
+ test_errors (fd, buffer);
+
+ /* This call hangs on AIX. */
+ close (fd);
+ }
+
#else
/* Try various master names of Mac OS X: /dev/pty[p-w][0-9a-f] */
@@ -196,6 +222,7 @@ main (void)
test_errors (fd, buffer);
+ /* This call hangs on AIX. */
close (fd);
}
}