diff options
author | Christopher Faylor <me@cgf.cx> | 2009-08-22 01:19:45 +0400 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2009-08-22 01:19:45 +0400 |
commit | e41f43a1a675ee6d0f21f2ab611c97ffe9c22088 (patch) | |
tree | 35bca25fa9908904bf55b91e93381b2d34a20e82 /winsup/cygwin/fcntl.cc | |
parent | 24149e4aa93d8d5739b610624c0c1db36f487ab5 (diff) |
* fcntl.cc (fcntl64): Detect negative fd as error.
Diffstat (limited to 'winsup/cygwin/fcntl.cc')
-rw-r--r-- | winsup/cygwin/fcntl.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index 442686268..bb41f05c5 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -40,7 +40,13 @@ fcntl64 (int fd, int cmd, ...) switch (cmd) { case F_DUPFD: - res = dup2 (fd, cygheap_fdnew (((int) arg) - 1)); + if ((int) arg >= 0) + res = dup2 (fd, cygheap_fdnew (((int) arg) - 1)); + else + { + set_errno (EINVAL); + res = -1; + } break; case F_GETLK: case F_SETLK: |