diff options
| author | Paul Eggert | 2013-08-20 23:11:50 -0700 |
|---|---|---|
| committer | Paul Eggert | 2013-08-20 23:11:50 -0700 |
| commit | f035e3a91c7fc311c7aec170ca93faae40818b3f (patch) | |
| tree | 2b4d23d42e01bdc67df4683ccc242d349115400c | |
| parent | 0d7c1e66ffad14f76fbd226d50113a61c738806c (diff) | |
| download | emacs-f035e3a91c7fc311c7aec170ca93faae40818b3f.tar.gz emacs-f035e3a91c7fc311c7aec170ca93faae40818b3f.zip | |
Port close-on-exec pty creation to FreeBSD 9.1-RELEASE.
* 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
| -rw-r--r-- | ChangeLog | 8 | ||||
| -rw-r--r-- | configure.ac | 2 |
2 files changed, 9 insertions, 1 deletions
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-08-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Port close-on-exec pty creation to FreeBSD 9.1-RELEASE (Bug#15129). | ||
| 4 | * configure.ac (PTY_OPEN): If posix_openpt with O_CLOEXEC fails | ||
| 5 | and reports EINVAL, try it again without O_CLOEXEC. This should | ||
| 6 | port PTY_OPEN to FreeBSD 9, which stupidly rejects O_CLOEXEC. | ||
| 7 | What were they thinking? | ||
| 8 | |||
| 1 | 2013-08-20 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2013-08-20 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | * Makefile.in (distclean, bootstrap-clean, maintainer-clean): | 11 | * Makefile.in (distclean, bootstrap-clean, maintainer-clean): |
diff --git a/configure.ac b/configure.ac index 980c36f75c7..793267b6ccb 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -3994,7 +3994,7 @@ case $opsys in | |||
| 3994 | 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); }]) | 3994 | 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); }]) |
| 3995 | dnl if HAVE_POSIX_OPENPT | 3995 | dnl if HAVE_POSIX_OPENPT |
| 3996 | if test "x$ac_cv_func_posix_openpt" = xyes; then | 3996 | if test "x$ac_cv_func_posix_openpt" = xyes; then |
| 3997 | AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY)]) | 3997 | 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)]) |
| 3998 | AC_DEFINE(PTY_NAME_SPRINTF, []) | 3998 | AC_DEFINE(PTY_NAME_SPRINTF, []) |
| 3999 | dnl if HAVE_GETPT | 3999 | dnl if HAVE_GETPT |
| 4000 | elif test "x$ac_cv_func_getpt" = xyes; then | 4000 | elif test "x$ac_cv_func_getpt" = xyes; then |