aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
authorDavid du Colombier <0intro@gmail.com>2017-10-13 10:26:51 +0200
committerDavid du Colombier <0intro@gmail.com>2017-10-13 10:26:51 +0200
commit7321ed031ceb9494751a8deb85fd224ff0520c39 (patch)
treeb7e18751cb712c41466955849b71b197b4561e2f /src/cmd/9term
parenta6a352886851eb0188b8c31e33933d4deb481d2e (diff)
downloadplan9port-7321ed031ceb9494751a8deb85fd224ff0520c39.tar.gz
plan9port-7321ed031ceb9494751a8deb85fd224ff0520c39.tar.bz2
plan9port-7321ed031ceb9494751a8deb85fd224ff0520c39.zip
9term: fix getpts on macOS 10.13
Since macOS 10.13, opening the /dev/ptyXX files always return ENOENT. Consequently, we changed getpts to use openpty to open a pseudoterminal, like on Linux and OpenBSD. Fixes #90. Fixes #110.
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/Darwin.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/9term/Darwin.c b/src/cmd/9term/Darwin.c
index eec79c28..0bd4ece7 100644
--- a/src/cmd/9term/Darwin.c
+++ b/src/cmd/9term/Darwin.c
@@ -1 +1,17 @@
+#define getpts not_using_this_getpts
#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;
+}