From 014fd65a5ca780823c0e75787f193d3c6597de8f Mon Sep 17 00:00:00 2001 From: Xiao-Yong Date: Tue, 13 Nov 2018 22:09:10 -0600 Subject: 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. --- src/cmd/9term/FreeBSD.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/cmd/9term') 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 + +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; +} -- cgit v1.2.3