The proposed attached patch makes use of posix_openpt() to open the pseudo-terminal device on modern POSIX compliant OS's supporting posix_openpt().
Patch to make use of posix_openpt()
Patch to make use of posix_openpt()