about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-11-24 00:05:59 +0100
committerOliver Kiddle <opk@zsh.org>2014-11-24 00:05:59 +0100
commita526a2203b26cb6b9d3546b92761f3b2217805ef (patch)
tree2faf080e7c1715fbe8fce70b8536064539702fdd
parent9161a16b2e2c770c7d518a394208476cf6c418fd (diff)
downloadzsh-a526a2203b26cb6b9d3546b92761f3b2217805ef.tar.gz
zsh-a526a2203b26cb6b9d3546b92761f3b2217805ef.tar.xz
zsh-a526a2203b26cb6b9d3546b92761f3b2217805ef.zip
33743: use posix_openpt in zpty if it is available
-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 \