summaryrefslogtreecommitdiff
path: root/gnulib-tests/test-dup-safer.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-09-30 18:22:48 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-09-30 18:22:48 +0400
commitc18578632fd3c9e513e613a86ba2b7c4ebee6c45 (patch)
tree377f4d4e3f0a6471a5012126078fcd97f4c67242 /gnulib-tests/test-dup-safer.c
parent974ab3dd887985e3aa347f3c6521f819296396a0 (diff)
downloadcoreutils-c18578632fd3c9e513e613a86ba2b7c4ebee6c45.tar.gz
Imported Upstream version 8.23upstream/8.23
Diffstat (limited to 'gnulib-tests/test-dup-safer.c')
-rw-r--r--gnulib-tests/test-dup-safer.c6
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;