]> git.eshelyaron.com Git - emacs.git/commitdiff
Port close-on-exec pty creation to FreeBSD 9.1-RELEASE.
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Aug 2013 06:11:50 +0000 (23:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 21 Aug 2013 06:11:50 +0000 (23:11 -0700)
* configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails
and reports EINVAL, try it again without O_CLOEXEC.  This should
port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC.
What were they thinking?

Fixes: debbugs:15129
ChangeLog
configure.ac

index a86343b09535354fbb3593a207ba1c6095a78b8c..161069800a47a9628e612a40426dd784b6ba55bc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-08-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port close-on-exec pty creation to FreeBSD 9.1-RELEASE (Bug#15129).
+       * configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails
+       and reports EINVAL, try it again without O_CLOEXEC.  This should
+       port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC.
+       What were they thinking?
+
 2013-08-20  Paul Eggert  <eggert@cs.ucla.edu>
 
        * Makefile.in (distclean, bootstrap-clean, maintainer-clean):
index 980c36f75c74df02e8feec49f5dc7ce5a02355b0..793267b6ccb425b31a411dae312ab891b466af07 100644 (file)
@@ -3994,7 +3994,7 @@ case $opsys in
       AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
       dnl if HAVE_POSIX_OPENPT
       if test "x$ac_cv_func_posix_openpt" = xyes; then
-        AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY)])
+        AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (0)])
         AC_DEFINE(PTY_NAME_SPRINTF, [])
       dnl if HAVE_GETPT
       elif test "x$ac_cv_func_getpt" = xyes; then