From ce1f4b93aa61736f8b77ed03e8a5cf80b86f1179 Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Wed, 9 Aug 1995 00:40:30 +0000 Subject: [PATCH] Changes for Alpha; also deal better with slave failure git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6472 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/telnet/telnetd/ChangeLog | 9 ++++++++- src/appl/telnet/telnetd/sys_term.c | 19 ++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/appl/telnet/telnetd/ChangeLog b/src/appl/telnet/telnetd/ChangeLog index 85405e47e..727cfa1be 100644 --- a/src/appl/telnet/telnetd/ChangeLog +++ b/src/appl/telnet/telnetd/ChangeLog @@ -1,8 +1,15 @@ +Tue Aug 8 11:26:54 1995 Sam Hartman + + * sys_term.c: Fail if the slave side dies. + (dup_tty): Renamed from login_tty because OSF already has that function and it isn't compatible. + + (getptyslave): Fix argument to fatalperror by including com_err.h instead of casting. Tue Aug 8 17:25:22 EDT 1995 Paul Park (pjpark@mit.edu) * sys_term.c - Cast argument to fatalperror(). -Mon Aug 7 18:29:21 1995 Sam Hartman + + * sys_term.c: Use new interface to pty_update_utmp. (getptyslave): Handle error return from pty_open_slave diff --git a/src/appl/telnet/telnetd/sys_term.c b/src/appl/telnet/telnetd/sys_term.c index 2e4c0e008..73cf0fb3f 100644 --- a/src/appl/telnet/telnetd/sys_term.c +++ b/src/appl/telnet/telnetd/sys_term.c @@ -35,6 +35,7 @@ #include "telnetd.h" #include "pathnames.h" +#include #ifndef LOGIN_PROGRAM #define LOGIN_PROGRAM _PATH_LOGIN @@ -960,7 +961,7 @@ getptyslave() if ( (retval = pty_open_slave (line, &t)) != 0 ) { - fatalperror(net, (char *) error_message(retval)); + fatalperror(net, error_message(retval)); } #ifdef STREAMSPTY @@ -1027,8 +1028,8 @@ termbuf.c_cflag |= HUPCL; * Set the tty modes, and make this our controlling tty. */ set_termbuf(); - if (login_tty(t) == -1) - fatalperror(net, "login_tty"); + if (dup_tty(t) == -1) + fatalperror(net, "dup_tty"); #endif /* !defined(CRAY) || !defined(NEWINIT) */ if (net > 2) (void) close(net); @@ -1052,10 +1053,10 @@ termbuf.c_cflag |= HUPCL; #endif /* !defined(CRAY) || !defined(NEWINIT) */ -#if BSD <= 43 + int -login_tty(t) +dup_tty(t) int t; { if (t != 0) @@ -1068,7 +1069,7 @@ login_tty(t) close(t); return(0); } -#endif /* BSD <= 43 */ + #ifdef NEWINIT char *gen_id = "fe"; @@ -1126,7 +1127,11 @@ slavepid = i; /* So we can clean it up later */ /* Wait for child before writing to parent side of pty.*/ (void) close(syncpipe[1]); - read(syncpipe[0], &c, 1); +if ( read(syncpipe[0], &c, 1) == 0 ) { + /* Slave side died */ + fatal ( net, "Slave failed to initialize"); +} + close(syncpipe[0]); -- 2.26.2