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.
This commit is contained in:
David du Colombier 2017-10-13 10:26:51 +02:00
parent a6a3528868
commit 7321ed031c

View file

@ -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;
}