nsenter: Convert dup2 calls to dup3

For consistency with similar changes required by go lang sources, convert the
C library dup2() calls to dup3().

The go language syscall.Dup2() routine is not available on all CPU
architectures, so yscall.Dup2() calls were converted to syscall.Dup3().

Signed-off-by: Geoff Levand <geoff@infradead.org>
This commit is contained in:
Geoff Levand 2015-06-09 15:19:47 -07:00
parent 0e8afb8f9d
commit 29ee54ce2a
1 changed files with 3 additions and 3 deletions

View File

@ -148,15 +148,15 @@ void nsexec()
pr_perror("ioctl TIOCSCTTY failed");
exit(1);
}
if (dup2(consolefd, STDIN_FILENO) != STDIN_FILENO) {
if (dup3(consolefd, STDIN_FILENO, 0) != STDIN_FILENO) {
pr_perror("Failed to dup 0");
exit(1);
}
if (dup2(consolefd, STDOUT_FILENO) != STDOUT_FILENO) {
if (dup3(consolefd, STDOUT_FILENO, 0) != STDOUT_FILENO) {
pr_perror("Failed to dup 1");
exit(1);
}
if (dup2(consolefd, STDERR_FILENO) != STDERR_FILENO) {
if (dup3(consolefd, STDERR_FILENO, 0) != STDERR_FILENO) {
pr_perror("Failed to dup 2");
exit(1);
}