From: Michael Kerrisk Date: Tue, 23 Mar 2021 10:33:40 +0000 (+0100) Subject: dup.2: Further clarify the effect of dup2() X-Git-Tag: man-pages-5.12~305 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b96ad91c7c5f7760d56d1db260e25277ed00a752;p=thirdparty%2Fman-pages.git 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 --- diff --git a/man2/dup.2 b/man2/dup.2 index b7fa3c4215..f90c7561bf 100644 --- a/man2/dup.2 +++ b/man2/dup.2 @@ -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;