Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 May 2012 16:31:44 +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: r234967 - stable/8/lib/libc/sys
Message-ID:  <201205031631.q43GVivl051904@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: eadler
Date: Thu May  3 16:31:44 2012
New Revision: 234967
URL: http://svn.freebsd.org/changeset/base/234967

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/lib/libc/sys/dup.2
  stable/8/lib/libc/sys/fcntl.2
Directory Properties:
  stable/8/lib/libc/   (props changed)
  stable/8/lib/libc/sys/   (props changed)

Modified: stable/8/lib/libc/sys/dup.2
==============================================================================
--- stable/8/lib/libc/sys/dup.2	Thu May  3 16:31:21 2012	(r234966)
+++ stable/8/lib/libc/sys/dup.2	Thu May  3 16:31:44 2012	(r234967)
@@ -123,20 +123,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 close 2 ,

Modified: stable/8/lib/libc/sys/fcntl.2
==============================================================================
--- stable/8/lib/libc/sys/fcntl.2	Thu May  3 16:31:21 2012	(r234966)
+++ stable/8/lib/libc/sys/fcntl.2	Thu May  3 16:31:44 2012	(r234967)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205031631.q43GVivl051904>