diff options
author | Eric Blake <eblake@redhat.com> | 2009-09-22 04:09:03 +0000 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2009-09-22 04:09:03 +0000 |
commit | 29bca9bb0c27d78ad328d8b8e9589535bf998a59 (patch) | |
tree | 90f5a4d416f4c89064e1f0770e4424d450fe7d6f /winsup/cygwin/fcntl.cc | |
parent | a7b24e14d7d38f234312c59612d4eed78835ed5b (diff) | |
download | newlib-29bca9bb0c27d78ad328d8b8e9589535bf998a59.zip newlib-29bca9bb0c27d78ad328d8b8e9589535bf998a59.tar.gz newlib-29bca9bb0c27d78ad328d8b8e9589535bf998a59.tar.bz2 |
Match dup2 and fcntl error values to POSIX.
* dtable.h (OPEN_MAX_MAX): New macro.
* resource.cc (getrlimit) [RLIMIT_NOFILE]: Use it.
* dtable.cc (dtable::extend): Likewise.
* fcntl.cc (fcntl64): Obey POSIX rule with too-large F_DUPFD.
* syscalls.cc (dup2): Likewise.
Diffstat (limited to 'winsup/cygwin/fcntl.cc')
-rw-r--r-- | winsup/cygwin/fcntl.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index bb41f05..78ce365 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -1,6 +1,7 @@ /* fcntl.cc: fcntl syscall - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2008 Red Hat, Inc. + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2008, + 2009 Red Hat, Inc. This file is part of Cygwin. @@ -40,7 +41,7 @@ fcntl64 (int fd, int cmd, ...) switch (cmd) { case F_DUPFD: - if ((int) arg >= 0) + if ((int) arg >= 0 && (int) arg < OPEN_MAX_MAX) res = dup2 (fd, cygheap_fdnew (((int) arg) - 1)); else { |