git: kernel: Fix error for dup2 if the new file descriptor is out of bounds.
swildner at crater.dragonflybsd.org
Thu Aug 21 13:13:45 PDT 2014
Author: Sascha Wildner <saw at online.de>
Date: Thu Aug 21 22:12:01 2014 +0200
kernel: Fix error for dup2 if the new file descriptor is out of bounds.
According to POSIX, when using fcntl()'s F_DUPFD or F_DUPFD_CLOEXEC
commands and the new file descriptor is out of bounds, EINVAL must be
returned. But if it is out of bounds when using dup2(), EBADF must be
So add detection of whether kern_dup() was called from kern_fcntl() or
from sys_dup2() and act accordingly.
Summary of changes:
sys/kern/kern_descrip.c | 28 ++++++++++++++++++----------
sys/sys/kern_syscall.h | 3 +--
2 files changed, 19 insertions(+), 12 deletions(-)
DragonFly BSD source repository
More information about the Commits