From 29ee54ce2a4b6faff2ae650d14092d0214e2b2f2 Mon Sep 17 00:00:00 2001 From: Geoff Levand <geoff@infradead.org> Date: Tue, 9 Jun 2015 15:19:47 -0700 Subject: [PATCH] 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> --- nsenter/nsexec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nsenter/nsexec.c b/nsenter/nsexec.c index d8e45f3c..d78e1691 100644 --- a/nsenter/nsexec.c +++ b/nsenter/nsexec.c @@ -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); }