diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | configh.in | 3 | ||||
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | io.c | 9 |
5 files changed, 19 insertions, 4 deletions
@@ -8,6 +8,13 @@ * main.c (main): Ditto. * builtin.c (do_system): Ditto. + Unrelated: + + * configure.ac: Look for posix_openpt + * io.c (two_way_open): Use posix_openpt if it's available. + Thanks to Christian Weisgerber <naddy@mips.inka.de> for + the changes. + 2012-12-07 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y (tokentab): `fflush()' is now in POSIX, remove the @@ -156,6 +156,9 @@ /* Define to 1 if you have the <netinet/in.h> header file. */ #undef HAVE_NETINET_IN_H +/* Define to 1 if you have the `posix_openpt' function. */ +#undef HAVE_POSIX_OPENPT + /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV @@ -9947,7 +9947,7 @@ esac for ac_func in atexit btowc fmod getgrent getgroups grantpt \ isascii iswctype iswlower iswupper mbrlen \ memcmp memcpy memcpy_ulong memmove memset \ - memset_ulong mkstemp setenv setlocale setsid snprintf strchr \ + memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \ strerror strftime strncasecmp strcoll strtod strtoul \ system tmpfile towlower towupper tzset usleep wcrtomb \ wcscoll wctype diff --git a/configure.ac b/configure.ac index fbd0232b..2db9ef72 100644 --- a/configure.ac +++ b/configure.ac @@ -269,7 +269,7 @@ esac AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \ isascii iswctype iswlower iswupper mbrlen \ memcmp memcpy memcpy_ulong memmove memset \ - memset_ulong mkstemp setenv setlocale setsid snprintf strchr \ + memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \ strerror strftime strncasecmp strcoll strtod strtoul \ system tmpfile towlower towupper tzset usleep wcrtomb \ wcscoll wctype) @@ -1598,7 +1598,7 @@ two_way_open(const char *str, struct redirect *rp) if (! no_ptys && pty_vs_pipe(str)) { static int initialized = FALSE; static char first_pty_letter; -#ifdef HAVE_GRANTPT +#if defined(HAVE_GRANTPT) && ! defined(HAVE_POSIX_OPENPT) static int have_dev_ptmx; #endif char slavenam[32]; @@ -1615,7 +1615,7 @@ two_way_open(const char *str, struct redirect *rp) if (! initialized) { initialized = TRUE; -#ifdef HAVE_GRANTPT +#if defined(HAVE_GRANTPT) && ! defined(HAVE_POSIX_OPENPT) have_dev_ptmx = (stat("/dev/ptmx", &statb) >= 0); #endif i = 0; @@ -1630,8 +1630,13 @@ two_way_open(const char *str, struct redirect *rp) } #ifdef HAVE_GRANTPT +#ifdef HAVE_POSIX_OPENPT + { + master = posix_openpt(O_RDWR|O_NOCTTY); +#else if (have_dev_ptmx) { master = open("/dev/ptmx", O_RDWR); +#endif if (master >= 0) { char *tem; |