updated vendored kr/pty to the current master + Solaris support:

https://github.com/kr/pty/pull/64
This commit is contained in:
Fazal Majid
2018-12-27 17:28:06 -08:00
parent a080c85cbc
commit 5c2242422a
18 changed files with 510 additions and 26 deletions

View File

@@ -8,23 +8,28 @@ import (
)
func open() (pty, tty *os.File, err error) {
p, err := os.OpenFile("/dev/ptmx", os.O_RDWR, 0)
pFD, err := syscall.Open("/dev/ptmx", syscall.O_RDWR|syscall.O_CLOEXEC, 0)
if err != nil {
return nil, nil, err
}
p := os.NewFile(uintptr(pFD), "/dev/ptmx")
// In case of error after this point, make sure we close the ptmx fd.
defer func() {
if err != nil {
_ = p.Close() // Best effort.
}
}()
sname, err := ptsname(p)
if err != nil {
return nil, nil, err
}
err = grantpt(p)
if err != nil {
if err := grantpt(p); err != nil {
return nil, nil, err
}
err = unlockpt(p)
if err != nil {
if err := unlockpt(p); err != nil {
return nil, nil, err
}