about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/zpty.c4
-rw-r--r--configure.ac1
3 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f8438db2..a11982965 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-11-23  Oliver Kiddle  <opk@zsh.org>
+
+	* 33743: Src/Modules/zpty.c, configure.ac: use posix_openpt
+	if it is available
+
 2014-11-23  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 33729: Completion/Unix/Command/_git: "git remote add" should
diff --git a/Src/Modules/zpty.c b/Src/Modules/zpty.c
index d119658c3..63c79a731 100644
--- a/Src/Modules/zpty.c
+++ b/Src/Modules/zpty.c
@@ -189,7 +189,11 @@ get_pty(int master, int *retfd)
 #endif
 
     if (master) {
+#ifdef HAVE_POSIX_OPENPT
+	if ((mfd = posix_openpt(O_RDWR|O_NOCTTY)) < 0)
+#else
 	if ((mfd = open("/dev/ptmx", O_RDWR|O_NOCTTY)) < 0)
+#endif
 	    return 1;
 
 	if (grantpt(mfd) || unlockpt(mfd) || !(name = ptsname(mfd))) {
diff --git a/configure.ac b/configure.ac
index 306a0057d..56c4cfb13 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1291,6 +1291,7 @@ AC_CHECK_FUNCS(strftime strptime mktime timelocal \
 	       pcre_compile pcre_study pcre_exec \
 	       nl_langinfo \
 	       erand48 open_memstream \
+	       posix_openpt \
 	       wctomb iconv \
 	       grantpt unlockpt ptsname \
 	       htons ntohs \