Date: Mon, 7 May 2012 12:20:27 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r235126 - stable/8/sys/kern Message-ID: <201205071220.q47CKR7E064254@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Mon May 7 12:20:26 2012 New Revision: 235126 URL: http://svn.freebsd.org/changeset/base/235126 Log: MFC r234131: Return EBADF instead of EMFILE from dup2 when the second argument is outside the range of valid file descriptors PR: kern/164970 Approved by: cperciva (implicit) Modified: stable/8/sys/kern/kern_descrip.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_descrip.c ============================================================================== --- stable/8/sys/kern/kern_descrip.c Mon May 7 12:19:49 2012 (r235125) +++ stable/8/sys/kern/kern_descrip.c Mon May 7 12:20:26 2012 (r235126) @@ -772,7 +772,7 @@ do_dup(struct thread *td, int flags, int maxfd = min((int)lim_cur(p, RLIMIT_NOFILE), maxfilesperproc); PROC_UNLOCK(p); if (new >= maxfd) - return (flags & DUP_FCNTL ? EINVAL : EMFILE); + return (flags & DUP_FCNTL ? EINVAL : EBADF); FILEDESC_XLOCK(fdp); if (old >= fdp->fd_nfiles || fdp->fd_ofiles[old] == NULL) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205071220.q47CKR7E064254>