aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term
diff options
context:
space:
mode:
authorXiao-Yong <jinxiaoyong@gmail.com>2018-11-13 22:09:10 -0600
committerRuss Cox <rsc@golang.org>2018-11-13 23:09:10 -0500
commit014fd65a5ca780823c0e75787f193d3c6597de8f (patch)
tree1f4148d841b1cdd137750bc76bf38add81116ef8 /src/cmd/9term
parent13ed1c423ecbd45d2ca982f2a7a433b785873629 (diff)
downloadplan9port-014fd65a5ca780823c0e75787f193d3c6597de8f.tar.gz
plan9port-014fd65a5ca780823c0e75787f193d3c6597de8f.tar.bz2
plan9port-014fd65a5ca780823c0e75787f193d3c6597de8f.zip
9term: fix getpts on FreeBSD 11.2 (#199)
Opening /dev/ptyXX files fails on recent FreeBSD versions. Following the same fix being applied to Linux, OpenBSD, and Darwin, we use openpty to open a pseudoterminal in openpts.
Diffstat (limited to 'src/cmd/9term')
-rw-r--r--src/cmd/9term/FreeBSD.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/9term/FreeBSD.c b/src/cmd/9term/FreeBSD.c
index eec79c28..e91f6ace 100644
--- a/src/cmd/9term/FreeBSD.c
+++ b/src/cmd/9term/FreeBSD.c
@@ -1 +1,17 @@
+#define getpts not_using_this_getpts
#include "bsdpty.c"
+#undef getpts
+
+#include <libutil.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;
+}