Date: Mon, 7 May 2012 12:19:49 +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-9@freebsd.org Subject: svn commit: r235125 - stable/9/sys/kern Message-ID: <201205071219.q47CJnxi064137@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Mon May 7 12:19:49 2012 New Revision: 235125 URL: http://svn.freebsd.org/changeset/base/235125 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/9/sys/kern/kern_descrip.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/kern_descrip.c ============================================================================== --- stable/9/sys/kern/kern_descrip.c Mon May 7 10:50:26 2012 (r235124) +++ stable/9/sys/kern/kern_descrip.c Mon May 7 12:19:49 2012 (r235125) @@ -815,7 +815,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?201205071219.q47CJnxi064137>