Skip to content

Commit 673fdea

Browse files
Julio Montesianlancetaylor
Julio Montes
authored andcommitted
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 <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent c6e7cb4 commit 673fdea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/syscall/exec_linux.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr
342342

343343
// Set the controlling TTY to Ctty
344344
if sys.Setctty {
345-
_, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 0)
345+
_, _, err1 = RawSyscall(SYS_IOCTL, uintptr(sys.Ctty), uintptr(TIOCSCTTY), 1)
346346
if err1 != 0 {
347347
goto childerror
348348
}

0 commit comments

Comments
 (0)