From: Ian Lance Taylor Date: Fri, 24 Jul 2020 22:13:43 +0000 (-0700) Subject: syscall: use correct file descriptor in dup2 fallback path X-Git-Tag: go1.15rc2~1^2~16 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8696ae82c94f0a7707cbbbdf2cec44e93edf5b23;p=gostls13.git syscall: use correct file descriptor in dup2 fallback path This fixes a mistake in CL 220422. This changes code that is only executed on Linux kernel versions earlier than 2.6.27. Change-Id: I01280184f4d7b75e06387c38f1891e8f0a81f793 Reviewed-on: https://go-review.googlesource.com/c/go/+/244630 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Tobias Klauser --- diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 23d7343d3a..b7351cda82 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -465,7 +465,7 @@ func forkAndExecInChild1(argv0 *byte, argv, envv []*byte, chroot, dir *byte, att } _, _, err1 = RawSyscall(SYS_DUP3, uintptr(fd[i]), uintptr(nextfd), O_CLOEXEC) if _SYS_dup != SYS_DUP3 && err1 == ENOSYS { - _, _, err1 = RawSyscall(_SYS_dup, uintptr(pipe), uintptr(nextfd), 0) + _, _, err1 = RawSyscall(_SYS_dup, uintptr(fd[i]), uintptr(nextfd), 0) if err1 != 0 { goto childerror }