From 1d0c8300e47d13fa26f1016e4c695ae9342f168b Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Fri, 4 May 2001 04:12:07 +0000 Subject: [PATCH] * pty-int.h: Fix typo; VHANG_first -> VHANG_FIRST * open_slave.c (pty_open_slave): Add workaround for Tru64 v5.0, since its revoke() will fail if the slave isn't open already. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13229 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 7 +++++++ src/util/pty/open_slave.c | 13 +++++++++++++ src/util/pty/pty-int.h | 9 +++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 51e5188cf..42f3a69eb 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,10 @@ +2001-05-04 Tom Yu + + * pty-int.h: Fix typo; VHANG_first -> VHANG_FIRST. + + * open_slave.c (pty_open_slave): Add workaround for Tru64 v5.0, + since its revoke() will fail if the slave isn't open already. + 2001-05-03 Ezra Peisach * sane_hostname.c (pty_make_sane_hostname): Preserve const diff --git a/src/util/pty/open_slave.c b/src/util/pty/open_slave.c index b8c332603..0e863d96a 100644 --- a/src/util/pty/open_slave.c +++ b/src/util/pty/open_slave.c @@ -78,9 +78,22 @@ long pty_open_slave ( slave, fd) return retval; #ifdef HAVE_REVOKE +#if defined(O_NOCTTY) && !defined(OPEN_CTTY_ONLY_ONCE) + /* + * Some OSes, notably Tru64 v5.0, fail on revoke() if the slave + * isn't open. Since we don't want to acquire it as controlling + * tty yet, use O_NOCTTY if available. + */ + vfd = open(slave, O_RDWR | O_NOCTTY); + if (vfd < 0) + return PTY_OPEN_SLAVE_OPENFAIL; +#endif if (revoke (slave) < 0 ) { return PTY_OPEN_SLAVE_REVOKEFAIL; } +#if defined(O_NOCTTY) && !defined(OPEN_CTTY_ONLY_ONCE) + close(vfd); +#endif #endif /*HAVE_REVOKE*/ /* Open the pty for real. */ diff --git a/src/util/pty/pty-int.h b/src/util/pty/pty-int.h index fa7f828f4..3f9d2cea3 100644 --- a/src/util/pty/pty-int.h +++ b/src/util/pty/pty-int.h @@ -85,8 +85,13 @@ #endif #endif -#if defined(HAVE_VHANGUP) && !defined(OPEN_CTTY_ONLY_ONCE) -#define VHANG_first /* Breaks under Ultrix and others where you cannot get controlling terminal twice.*/ +#if defined(HAVE_VHANGUP) && !defined(OPEN_CTTY_ONLY_ONCE) \ + && !defined(HAVE_REVOKE) +/* + * Breaks under Ultrix and others where you cannot get controlling + * terminal twice. + */ +#define VHANG_FIRST #define VHANG_LAST #endif -- 2.26.2