diff options
author | eadler <eadler@FreeBSD.org> | 2012-04-11 14:08:09 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2012-04-11 14:08:09 +0000 |
commit | 2a42c5c4e9a67b8056503efa70123b09f23811a4 (patch) | |
tree | 065af16fe40415e5e57f7a5b17e4a6e37c545499 /lib/libc/sys/dup.2 | |
parent | 1143c81c4284fefdc79cc59b53b79a161b0f3a43 (diff) | |
download | FreeBSD-src-2a42c5c4e9a67b8056503efa70123b09f23811a4.zip FreeBSD-src-2a42c5c4e9a67b8056503efa70123b09f23811a4.tar.gz |
Return EBADF instead of EMFILE from dup2 when the second argument is
outside the range of valid file descriptors
PR: kern/164970
Submitted by: Peter Jeremy <peterjeremy@acm.org>
Reviewed by: jilles
Approved by: cperciva
MFC after: 1 week
Diffstat (limited to 'lib/libc/sys/dup.2')
-rw-r--r-- | lib/libc/sys/dup.2 | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libc/sys/dup.2 b/lib/libc/sys/dup.2 index f6f6f46..d2a4b7e 100644 --- a/lib/libc/sys/dup.2 +++ b/lib/libc/sys/dup.2 @@ -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 , |