changeset 15708:7eaba4a7b6f5

utimensat tests: EBADF tests. * tests/test-utimensat.c (main): Add tests for EBADF.
author Bruno Haible <bruno@clisp.org>
date Tue, 20 Sep 2011 22:49:52 +0200
parents b9ce5dc1f411
children 8a6b8369787e
files ChangeLog tests/test-utimensat.c
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-09-20  Bruno Haible  <bruno@clisp.org>
 
+	utimensat tests: EBADF tests.
+	* tests/test-utimensat.c (main): Add tests for EBADF.
+
 	renameat tests: EBADF tests.
 	* tests/test-renameat.c (main): Add tests for EBADF.
 
--- a/tests/test-utimensat.c
+++ b/tests/test-utimensat.c
@@ -69,6 +69,18 @@
   /* Clean up any trash from prior testsuite runs.  */
   ignore_value (system ("rm -rf " BASE "*"));
 
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (utimensat (-1, "foo", NULL, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+  {
+    errno = 0;
+    ASSERT (utimensat (99, "foo", NULL, 0) == -1);
+    ASSERT (errno == EBADF);
+  }
+
   /* Basic tests.  */
   result1 = test_utimens (do_utimensat, true);
   result2 = test_lutimens (do_lutimensat, result1 == 0);