* fcntl.cc (fcntl64): Detect negative fd as error.

This commit is contained in:
Christopher Faylor 2009-08-21 21:19:45 +00:00
parent 24149e4aa9
commit e41f43a1a6
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2009-08-21 Christopher Faylor <me+cygwin@cgf.cx>
* fcntl.cc (fcntl64): Detect negative fd as error.
2009-08-21 Corinna Vinschen <corinna@vinschen.de>
* mmap.cc (mmap64): Allocate fh_disk_file on cygheap. Delete

View File

@ -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: