diff options
author | Petter Rodhelind <petter.rodhelind@gmail.com> | 2017-11-06 15:25:36 +0100 |
---|---|---|
committer | Petter Rodhelind <petter.rodhelind@gmail.com> | 2017-11-06 15:25:36 +0100 |
commit | 507ff32f4ae1a62c28ddf7a9bfd7f82ff77d982e (patch) | |
tree | 83c841c621b8bcdcc706e04a44c26207779e5daa /src/cmd/9term | |
parent | a8c75a106f5d6e283c6b23e2592207ee5d5bce29 (diff) | |
download | plan9port-507ff32f4ae1a62c28ddf7a9bfd7f82ff77d982e.tar.gz plan9port-507ff32f4ae1a62c28ddf7a9bfd7f82ff77d982e.tar.bz2 plan9port-507ff32f4ae1a62c28ddf7a9bfd7f82ff77d982e.zip |
9term: Fix ptys in MacOS High Sierra.
Diffstat (limited to 'src/cmd/9term')
-rw-r--r-- | src/cmd/9term/Darwin.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/cmd/9term/Darwin.c b/src/cmd/9term/Darwin.c index 0bd4ece7..369f7da2 100644 --- a/src/cmd/9term/Darwin.c +++ b/src/cmd/9term/Darwin.c @@ -2,16 +2,19 @@ #include "bsdpty.c" #undef getpts -#include <util.h> - int getpts(int fd[], char *slave) { - if(openpty(&fd[1], &fd[0], NULL, NULL, NULL) >= 0){ - fchmod(fd[1], 0620); - strcpy(slave, ttyname(fd[0])); - return 0; - } - sysfatal("no ptys"); - return 0; + fd[1] = posix_openpt(ORDWR); + if (fd[1] >= 0) { + grantpt(fd[1]); + unlockpt(fd[1]); + fchmod(fd[1], 0620); + strcpy(slave, ptsname(fd[1])); + if ((fd[0] = open(slave, ORDWR)) >= 0) + return 0; + close(fd[1]); + } + sysfatal("no ptys"); + return 0; } |