diff options
Diffstat (limited to 'man2/dup.2')
-rw-r--r-- | man2/dup.2 | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/man2/dup.2 b/man2/dup.2 index f69922be4..b38e4dd08 100644 --- a/man2/dup.2 +++ b/man2/dup.2 @@ -255,21 +255,21 @@ Instead, code something like the following could be used: /* Obtain a duplicate of \[aq]newfd\[aq] that can subsequently be used to check for close() errors; an EBADF error means that \[aq]newfd\[aq] was not open. */ - +\& tmpfd = dup(newfd); if (tmpfd == \-1 && errno != EBADF) { /* Handle unexpected dup() error. */ } - +\& /* Atomically duplicate \[aq]oldfd\[aq] on \[aq]newfd\[aq]. */ - +\& if (dup2(oldfd, newfd) == \-1) { /* Handle dup2() error. */ } - +\& /* Now check for close() errors on the file originally referred to by \[aq]newfd\[aq]. */ - +\& if (tmpfd != \-1) { if (close(tmpfd) == \-1) { /* Handle errors from close. */ |