AT_FDCWD is only supposed to be special in *at functions.
* tests/test-dup2.c (main): Also check AT_FDCWD.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-10-10 Eric Blake <ebb9@byu.net>
+ test-dup2: enhance test
+ * tests/test-dup2.c (main): Also check AT_FDCWD.
+
test-stat-time: avoid more spurious failures
* tests/test-stat-time.c (nap): Wait for 15ms rather than 2ms, for
xfs; and avoid race if the two timestamps cross quantization edge.
ASSERT (dup2 (fd, fd) == fd);
ASSERT (is_open (fd));
+ /* The source must be valid. */
+ errno = 0;
+ ASSERT (dup2 (-1, fd) == -1);
+ ASSERT (errno == EBADF);
+ errno = 0;
+ ASSERT (dup2 (AT_FDCWD, fd) == -1);
+ ASSERT (errno == EBADF);
+ ASSERT (is_open (fd));
+
/* If the source is not open, then the destination is unaffected. */
errno = 0;
ASSERT (dup2 (fd + 1, fd + 1) == -1);