fdopendir tests: EBADF tests.
authorBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 20:39:51 +0000 (22:39 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 21:27:59 +0000 (23:27 +0200)
* tests/test-fdopendir.c (main): Add more tests for EBADF.

ChangeLog
tests/test-fdopendir.c

index 04668ed..d0cfe90 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-09-20  Bruno Haible  <bruno@clisp.org>
 
+       fdopendir tests: EBADF tests.
+       * tests/test-fdopendir.c (main): Add more tests for EBADF.
+
        openat tests: EBADF tests.
        * tests/test-fchownat.c (main): Add tests for EBADF.
        * tests/test-fstatat.c (main): Likewise.
index 13653fe..b578a5c 100644 (file)
@@ -48,9 +48,16 @@ main (int argc _GL_UNUSED, char *argv[])
   ASSERT (unlink ("test-fdopendir.tmp") == 0);
 
   /* A bad fd cannot be turned into a stream.  */
-  errno = 0;
-  ASSERT (fdopendir (-1) == NULL);
-  ASSERT (errno == EBADF);
+  {
+    errno = 0;
+    ASSERT (fdopendir (-1) == NULL);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (fdopendir (99) == NULL);
+    ASSERT (errno == EBADF);
+  }
 
   /* This should work.  */
   fd = open (".", O_RDONLY);