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.
This commit is contained in:
parent
13ed1c423e
commit
014fd65a5c
1 changed files with 16 additions and 0 deletions
|
|
@ -1 +1,17 @@
|
||||||
|
#define getpts not_using_this_getpts
|
||||||
#include "bsdpty.c"
|
#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;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue