mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Patch from Brad Smith to use posix_openpt() instead of
open("/dev/ptmx"), where the former is available. Improves portability, since at least one OS (OpenBSD) supports the POSIX pty functions but does it via an underlying mechanism which doesn't involving having a /dev/ptmx. [originally from svn r9728]
This commit is contained in:
@ -342,12 +342,21 @@ static void pty_open_master(Pty pty)
|
||||
#endif
|
||||
;
|
||||
|
||||
#ifdef HAVE_POSIX_OPENPT
|
||||
pty->master_fd = posix_openpt(flags);
|
||||
|
||||
if (pty->master_fd < 0) {
|
||||
perror("posix_openpt");
|
||||
exit(1);
|
||||
}
|
||||
#else
|
||||
pty->master_fd = open("/dev/ptmx", flags);
|
||||
|
||||
if (pty->master_fd < 0) {
|
||||
perror("/dev/ptmx: open");
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (grantpt(pty->master_fd) < 0) {
|
||||
perror("grantpt");
|
||||
|
Reference in New Issue
Block a user