From 673fdea5e798baa98c418cba86cf50c8d80cbc36 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Mon, 22 May 2017 10:33:31 -0500 Subject: [PATCH] syscall: allow processes steal a controlling terminal on Linux The current implementation of forkAndExecInChild for Linux does not allow spawned processes steal the controlling terminal from a different session group. This patch passes 1 as the argument to TIOCSCTTY in order to allow spawned processes steal controlling terminals. Fixes #20454 Change-Id: I171b8981509d648b07f89bddc1e9d45cb70e00e6 Reviewed-on: https://go-review.googlesource.com/44343 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor --- src/syscall/exec_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syscall/exec_linux.go b/src/syscall/exec_linux.go index 66fb0356ba..5f53eaaa36 100644 --- a/src/syscall/exec_linux.go +++ b/src/syscall/exec_linux.go @@ -342,7 +342,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // Set the controlling TTY to Ctty if sys.Setctty { - _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0) + _, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 1) if err1 != 0 { goto childerror } -- 2.50.0