From 8e542575e044baf23ae636d32f1c6d4e3b8dea18 Mon Sep 17 00:00:00 2001 From: OBATA Akio Date: Fri, 28 Aug 2020 16:08:41 +0900 Subject: Add support of posix_openpt(2) to open master pseudo terminal device Signed-off-by: OBATA Akio --- tdesu/tdesu_pty.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tdesu') diff --git a/tdesu/tdesu_pty.cpp b/tdesu/tdesu_pty.cpp index 207c0a3e2..4b01dde86 100644 --- a/tdesu/tdesu_pty.cpp +++ b/tdesu/tdesu_pty.cpp @@ -94,10 +94,14 @@ PTY::~PTY() int PTY::getpt() { -#if defined(HAVE_GETPT) && defined(HAVE_PTSNAME) +#if (defined(HAVE_GETPT) || defined(HAVE_POSIX_OPENPT)) && defined(HAVE_PTSNAME) // 1: UNIX98: preferred way +#ifdef HAVE_GETPT ptyfd = ::getpt(); +#elif defined(HAVE_POSIX_OPENPT) + ptyfd = ::posix_openpt(O_RDWR); +#endif ttyname = ::ptsname(ptyfd); return ptyfd; -- cgit v1.2.1