git: kernel: Fix error for dup2 if the new file descriptor is out of bounds.

Sascha Wildner swildner at crater.dragonflybsd.org
Thu Aug 21 13:13:45 PDT 2014


commit 0422901361dc1495e5af3332f7c97aac1f7992ff
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
    returned.
    
    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(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/0422901361dc1495e5af3332f7c97aac1f7992ff


-- 
DragonFly BSD source repository



More information about the Commits mailing list