summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/dup.2
diff options
context:
space:
mode:
authormckay <mckay@FreeBSD.org>1997-03-09 13:16:48 +0000
committermckay <mckay@FreeBSD.org>1997-03-09 13:16:48 +0000
commit0df49cb9cfc20544d5a22327db106151826ea246 (patch)
tree1155d675c47c2b4a076bfe0112eaab542a1fb28a /lib/libc/sys/dup.2
parent01b8721dc82dd688e63a96a5d4488a7b53b3bad4 (diff)
downloadFreeBSD-src-0df49cb9cfc20544d5a22327db106151826ea246.zip
FreeBSD-src-0df49cb9cfc20544d5a22327db106151826ea246.tar.gz
Clarified the behaviour of dup2(fd1,fd2) when fd1==fd2 and when fd1 is invalid.
Safe for 2.2!
Diffstat (limited to 'lib/libc/sys/dup.2')
-rw-r--r--lib/libc/sys/dup.225
1 files changed, 21 insertions, 4 deletions
diff --git a/lib/libc/sys/dup.2 b/lib/libc/sys/dup.2
index 66c9d29..58a967d 100644
--- a/lib/libc/sys/dup.2
+++ b/lib/libc/sys/dup.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)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
.Dt DUP 2
@@ -92,10 +92,27 @@ In
.Fn dup2 ,
the value of the new descriptor
.Fa newd
-is specified. If this descriptor is already
-in use, the descriptor is first deallocated as if a
+is specified. If this descriptor is already in use and
+.Fa oldd
+!=
+.Fa newd ,
+the descriptor is first deallocated as if a
.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
.Pp
In the non-threaded library
OpenPOWER on IntegriCloud