dup.2: Further clarify the effect of dup2()

Add a sentence explaining what dup2() does in terms of file
descriptors and open file descriptions.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-03-23 11:33:40 +01:00
parent 8b339e35fa
commit b96ad91c7c
1 changed files with 6 additions and 0 deletions

View File

@ -86,6 +86,12 @@ system call performs the same task as
but instead of using the lowest-numbered unused file descriptor,
it uses the file descriptor number specified in
.IR newfd .
In other words,
the file descriptor
.I newfd
is adjusted so that it now refers to the same open file description as
.IR oldfd .
.PP
If the file descriptor
.IR newfd
was previously open, it is closed before being reused;