diff options
Diffstat (limited to 'gnulib-tests/test-dup-safer.c')
-rw-r--r-- | gnulib-tests/test-dup-safer.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gnulib-tests/test-dup-safer.c b/gnulib-tests/test-dup-safer.c index d7567e01..d11891e7 100644 --- a/gnulib-tests/test-dup-safer.c +++ b/gnulib-tests/test-dup-safer.c @@ -1,5 +1,5 @@ /* Test that dup_safer leaves standard fds alone. - Copyright (C) 2009-2013 Free Software Foundation, Inc. + Copyright (C) 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #include <errno.h> #include <stdbool.h> #include <stdio.h> +#include <unistd.h> #include "binary-io.h" #include "cloexec.h" @@ -107,6 +108,7 @@ main (void) { int i; int fd; + int bad_fd = getdtablesize (); /* We close fd 2 later, so save it in fd 10. */ if (dup2 (STDERR_FILENO, BACKUP_STDERR_FILENO) != BACKUP_STDERR_FILENO @@ -129,7 +131,7 @@ main (void) ASSERT (dup (-1) == -1); ASSERT (errno == EBADF); errno = 0; - ASSERT (dup (10000000) == -1); + ASSERT (dup (bad_fd) == -1); ASSERT (errno == EBADF); close (fd + 1); errno = 0; |