diff options
Diffstat (limited to 'gl/tests/test-dup2.c')
-rw-r--r-- | gl/tests/test-dup2.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gl/tests/test-dup2.c b/gl/tests/test-dup2.c index 9600c850b1..ecb2692d2a 100644 --- a/gl/tests/test-dup2.c +++ b/gl/tests/test-dup2.c @@ -26,6 +26,10 @@ SIGNATURE_CHECK (dup2, int, (int, int)); #include <errno.h> #include <fcntl.h> +#if HAVE_SYS_RESOURCE_H +# include <sys/resource.h> +#endif + #include "binary-io.h" #if GNULIB_TEST_CLOEXEC @@ -103,6 +107,7 @@ main (void) { const char *file = "test-dup2.tmp"; char buffer[1]; + int bad_fd = getdtablesize (); int fd = open (file, O_CREAT | O_TRUNC | O_RDWR, 0600); /* Assume std descriptors were provided by invoker. */ @@ -146,7 +151,7 @@ main (void) ASSERT (dup2 (fd, -2) == -1); ASSERT (errno == EBADF); errno = 0; - ASSERT (dup2 (fd, 10000000) == -1); + ASSERT (dup2 (fd, bad_fd) == -1); ASSERT (errno == EBADF); /* Using dup2 can skip fds. */ |