]> Savannah Git Hosting - gnulib.git/commitdiff
ptsname test: Extend test.
authorBruno Haible <bruno@clisp.org>
Sun, 24 Jun 2012 12:53:43 +0000 (14:53 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 24 Jun 2012 12:54:20 +0000 (14:54 +0200)
* tests/test-ptsname.c: Include <errno.h>.
(main): Test behaviour with invalid file descriptor.

ChangeLog
tests/test-ptsname.c

index df898598f48107a55bded5e36e36acfda84db7f3..45173a46d6377c8ce6f31621eb05fa132f760397 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-06-24  Bruno Haible  <bruno@clisp.org>
+
+       ptsname test: Extend test.
+       * tests/test-ptsname.c: Include <errno.h>.
+       (main): Test behaviour with invalid file descriptor.
+
 2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
 
        time: fix obsolete comment
index 06c78ea1dd2b0dbb2c36abb457333f3087821375..d27e7d6643905c4aed9164c06279c76fcb1a5dc9 100644 (file)
@@ -21,6 +21,7 @@
 #include "signature.h"
 SIGNATURE_CHECK (ptsname, char *, (int));
 
+#include <errno.h>
 #include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
@@ -62,6 +63,17 @@ main (void)
   alarm (5);
 #endif
 
+  {
+    char *result;
+
+    errno = 0;
+    result = ptsname (-1);
+    ASSERT (result == NULL);
+    ASSERT (errno == EBADF
+            || errno == ENOTTY /* seen on glibc */
+           );
+  }
+
   {
     int fd;
     char *result;