From owner-svn-src-stable@FreeBSD.ORG Thu May 3 16:31:22 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 526B31065673; Thu, 3 May 2012 16:31:22 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A1E3E8FC1A; Thu, 3 May 2012 16:31:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q43GVLEP051861; Thu, 3 May 2012 16:31:21 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q43GVL1j051858; Thu, 3 May 2012 16:31:21 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201205031631.q43GVL1j051858@svn.freebsd.org> From: Eitan Adler Date: Thu, 3 May 2012 16:31:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234966 - stable/9/lib/libc/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 May 2012 16:31:22 -0000 Author: eadler Date: Thu May 3 16:31:21 2012 New Revision: 234966 URL: http://svn.freebsd.org/changeset/base/234966 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/lib/libc/sys/dup.2 stable/9/lib/libc/sys/fcntl.2 Directory Properties: stable/9/lib/libc/ (props changed) stable/9/lib/libc/sys/ (props changed) Modified: stable/9/lib/libc/sys/dup.2 ============================================================================== --- stable/9/lib/libc/sys/dup.2 Thu May 3 16:21:26 2012 (r234965) +++ stable/9/lib/libc/sys/dup.2 Thu May 3 16:31:21 2012 (r234966) @@ -128,20 +128,27 @@ indicates the cause of the error. .Sh ERRORS The .Fn dup -and -.Fn dup2 -system calls fail if: +system call fails if: .Bl -tag -width Er .It Bq Er EBADF The .Fa oldd -or -.Fa newd argument is not a valid active descriptor .It Bq Er EMFILE Too many descriptors are active. .El +The +.Fn dup2 +system call fails if: +.Bl -tag -width Er +.It Bq Er EBADF +The +.Fa oldd +argument is not a valid active descriptor or the +.Fa newd +argument is negative or exceeds the maximum allowable descriptor number +.El .Sh SEE ALSO .Xr accept 2 , .Xr cap_new 2 , Modified: stable/9/lib/libc/sys/fcntl.2 ============================================================================== --- stable/9/lib/libc/sys/fcntl.2 Thu May 3 16:21:26 2012 (r234965) +++ stable/9/lib/libc/sys/fcntl.2 Thu May 3 16:31:21 2012 (r234966) @@ -539,8 +539,6 @@ The argument .Fa cmd is .Dv F_DUPFD -or -.Dv F_DUP2FD and the maximum number of file descriptors permitted for the process are already in use, or no file descriptors greater than or equal to