summaryrefslogtreecommitdiffstats
path: root/tdesu
diff options
context:
space:
mode:
authorOBATA Akio <obache@wizdas.com>2020-08-28 16:08:41 +0900
committerTDE Gitea <gitea@mirror.git.trinitydesktop.org>2020-08-31 09:52:13 +0000
commit8e542575e044baf23ae636d32f1c6d4e3b8dea18 (patch)
tree168005cca38ba0cc5bc25e514fe20d4b310db66d /tdesu
parentac8c8ca54aaed1466255161a3d727dcfade4a7d9 (diff)
downloadtdelibs-8e542575e044baf23ae636d32f1c6d4e3b8dea18.tar.gz
tdelibs-8e542575e044baf23ae636d32f1c6d4e3b8dea18.zip
Add support of posix_openpt(2) to open master pseudo terminal device
Signed-off-by: OBATA Akio <obache@wizdas.com>
Diffstat (limited to 'tdesu')
-rw-r--r--tdesu/tdesu_pty.cpp6
1 files changed, 5 insertions, 1 deletions
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;