diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-09 21:35:46 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-12-09 21:35:46 +0200 |
commit | 134fa0445295460d897661ee18027c645b2baa73 (patch) | |
tree | 7af792097e7d23bd9cec91c31dd9e525a62f6245 /io.c | |
parent | 4ed8e81f87aadda3521a967b5c5e714bf027194b (diff) | |
download | egawk-134fa0445295460d897661ee18027c645b2baa73.tar.gz egawk-134fa0445295460d897661ee18027c645b2baa73.tar.bz2 egawk-134fa0445295460d897661ee18027c645b2baa73.zip |
Use posix_openpt() if available.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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; |