symlinkat tests: EBADF tests.
authorBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 20:44:41 +0000 (22:44 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 20 Sep 2011 21:28:00 +0000 (23:28 +0200)
* tests/test-symlinkat.c (main): Add tests for EBADF.

ChangeLog
tests/test-symlinkat.c

index 1c37270..05ed341 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2011-09-20  Bruno Haible  <bruno@clisp.org>
 
+       symlinkat tests: EBADF tests.
+       * tests/test-symlinkat.c (main): Add tests for EBADF.
+
        linkat tests: EBADF tests.
        * tests/test-linkat.c (main): Add tests for EBADF.
 
index 1795c0e..46826ec 100644 (file)
@@ -58,6 +58,22 @@ main (void)
   /* Remove any leftovers from a previous partial run.  */
   ignore_value (system ("rm -rf " BASE "*"));
 
+  /* Test behaviour for invalid file descriptors.  */
+  {
+    errno = 0;
+    ASSERT (symlinkat ("foo", -1, "bar") == -1);
+    ASSERT (errno == EBADF
+            || errno == ENOSYS /* seen on mingw */
+           );
+  }
+  {
+    errno = 0;
+    ASSERT (symlinkat ("foo", 99, "bar") == -1);
+    ASSERT (errno == EBADF
+            || errno == ENOSYS /* seen on mingw */
+           );
+  }
+
   /* Perform same checks as counterpart functions.  */
   result = test_symlink (do_symlink, false);
   dfd = openat (AT_FDCWD, ".", O_RDONLY);