Clarified the behaviour of dup2(fd1,fd2) when fd1==fd2 and when fd1 is invalid.

Safe for 2.2!
This commit is contained in:
Stephen McKay 1997-03-09 13:16:48 +00:00
parent eac4b079c7
commit ac225cf76d

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" @(#)dup.2 8.1 (Berkeley) 6/4/93 .\" @(#)dup.2 8.1 (Berkeley) 6/4/93
.\" $Id$ .\" $Id: dup.2,v 1.7 1997/02/22 15:03:49 peter Exp $
.\" .\"
.Dd June 4, 1993 .Dd June 4, 1993
.Dt DUP 2 .Dt DUP 2
@ -92,10 +92,27 @@ In
.Fn dup2 , .Fn dup2 ,
the value of the new descriptor the value of the new descriptor
.Fa newd .Fa newd
is specified. If this descriptor is already is specified. If this descriptor is already in use and
in use, the descriptor is first deallocated as if a .Fa oldd
!=
.Fa newd ,
the descriptor is first deallocated as if a
.Xr close 2 .Xr close 2
call had been done first. call had been used.
If
.Fa oldd
is not a valid descriptor, then
.Fa newd
is not closed.
If
.Fa oldd
==
.Fa newd
and
.Fa oldd
is a valid descriptor, then
.Fn dup2
is successful, and does nothing.
.Sh IMPLEMENTATION NOTES .Sh IMPLEMENTATION NOTES
.Pp .Pp
In the non-threaded library In the non-threaded library