fsync tests: EBADF tests.
authorBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 20:05:29 +0000 (22:05 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 20:05:29 +0000 (22:05 +0200)
* tests/test-fsync.c (main): Add more tests for EBADF.

ChangeLog
tests/test-fsync.c

index d1bf875..ebd17b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-09-20  Bruno Haible  <bruno@clisp.org>
 
+       fsync tests: EBADF tests.
+       * tests/test-fsync.c (main): Add more tests for EBADF.
+
        fdatasync tests: EBADF tests.
        * tests/test-fdatasync.c (main): Add more tests for EBADF.
 
index b9f0fb0..9565f52 100644 (file)
@@ -44,9 +44,16 @@ main (void)
       }
 
   /* fsync must fail on invalid fd.  */
-  errno = 0;
-  ASSERT (fsync (-1) == -1);
-  ASSERT (errno == EBADF);
+  {
+    errno = 0;
+    ASSERT (fsync (-1) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (fsync (99) == -1);
+    ASSERT (errno == EBADF);
+  }
 
   fd = open (file, O_WRONLY|O_CREAT|O_TRUNC, 0644);
   ASSERT (0 <= fd);