The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/7352
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === We made this our controlling terminal which is a bit of an issue. Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 6f123325150ff49bef6d7d67570a92ce20233b3e Mon Sep 17 00:00:00 2001 From: Christian Brauner <christian.brau...@ubuntu.com> Date: Tue, 12 May 2020 11:04:53 +0200 Subject: [PATCH] openpty: fix TIOCGPTPEER usage We made this our controlling terminal which is a bit of an issue. Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com> --- shared/util_linux.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/shared/util_linux.go b/shared/util_linux.go index 4957a312bb..c0e6766c54 100644 --- a/shared/util_linux.go +++ b/shared/util_linux.go @@ -415,9 +415,16 @@ func OpenPty(uid, gid int64) (*os.File, *os.File, error) { } var slave *os.File - slaveFd, err := unix.IoctlRetInt(int(master.Fd()), unix.TIOCGPTPEER) + slaveFd, _, err := unix.Syscall(unix.SYS_IOCTL, uintptr(master.Fd()), unix.TIOCGPTPEER, uintptr(unix.O_NOCTTY|unix.O_CLOEXEC|os.O_RDWR)) if err == nil { - slave = os.NewFile(uintptr(slaveFd), fmt.Sprintf("%d", slaveFd)) + // Get the slave side. + id := 0 + _, _, errno = unix.Syscall(unix.SYS_IOCTL, uintptr(master.Fd()), unix.TIOCGPTN, uintptr(unsafe.Pointer(&id))) + if errno != 0 { + return nil, nil, unix.Errno(errno) + } + + slave = os.NewFile(uintptr(slaveFd), fmt.Sprintf("/dev/pts/%d", id)) } else { // Get the slave side. id := 0
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel