/* Test that dup_safer leaves standard fds alone.
- Copyright (C) 2009-2012 Free Software Foundation, Inc.
+ Copyright (C) 2009-2013 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
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
+#include <unistd.h>
#include "binary-io.h"
#include "cloexec.h"
{
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
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;