aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2012-12-31 18:31:49 +0000
committerChristopher Faylor <me@cgf.cx>2012-12-31 18:31:49 +0000
commitf6187d46b117f281040e2b9a9f3bdabe60954156 (patch)
treefbc8df0e5be98ae0c76f22b4f7a71e4bd017a197 /winsup/cygwin/syscalls.cc
parent871d0724fa3251afb026608af733d6eea4dce8fd (diff)
downloadnewlib-f6187d46b117f281040e2b9a9f3bdabe60954156.zip
newlib-f6187d46b117f281040e2b9a9f3bdabe60954156.tar.gz
newlib-f6187d46b117f281040e2b9a9f3bdabe60954156.tar.bz2
* dtable.cc (dtable::dup3): Fix bounds checking for valid newfd.
* syscalls.cc (dup2): Ditto. * winsup.h (events_terminate): Delete obsolete function declaration.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 43ecf3a..fe89f84 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -142,7 +142,7 @@ extern "C" int
dup2 (int oldfd, int newfd)
{
int res;
- if (newfd >= OPEN_MAX_MAX)
+ if (newfd >= OPEN_MAX_MAX || newfd < 0)
{
set_errno (EBADF);
res = -1;