mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
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:
+3
-3
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user