futimens: enhance test
authorEric Blake <eblake@redhat.com>
Mon, 19 Sep 2011 17:10:16 +0000 (11:10 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 19 Sep 2011 17:10:16 +0000 (11:10 -0600)
Test that previous futimens change doesn't regress.

* tests/test-futimens.h (test_futimens): Also check for EBADF on
closed non-negative fd.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
tests/test-futimens.h

index ddbbe0e..32f3723 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2011-09-19  Eric Blake  <eblake@redhat.com>
 
+       futimens: enhance test
+       * tests/test-futimens.h (test_futimens): Also check for EBADF on
+       closed non-negative fd.
+
        date: accept 'hence' as opposite of 'ago'
        * lib/parse-datetime.y (relative_time_table): Add 'hence'.
        * tests/test-parse-datetime.c (main): Enhance test.
index 13e7d92..451edd9 100644 (file)
@@ -81,6 +81,14 @@ test_futimens (int (*func) (int, struct timespec const *),
   ASSERT (func (-1, NULL) == -1);
   ASSERT (errno == EBADF);
   {
+    int fd = dup (0);
+    ASSERT (0 <= fd);
+    ASSERT (close (fd) == 0);
+    errno = 0;
+    ASSERT (func (fd, NULL) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
     struct timespec ts[2] = { { Y2K, UTIME_BOGUS_POS }, { Y2K, 0 } };
     errno = 0;
     ASSERT (func (fd, ts) == -1);