From 9c36f64ce36f44f806005366ccccf06cdf8e9c4a Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Sat, 7 Jun 1997 02:38:53 +0000 Subject: [PATCH] login.c: Always use the new tty line discpline. [krb5-appl/428] login.c: If a hangup signal is received, pass it onto the child. [krb5-appl/432] git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10095 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 7 +++++++ src/appl/bsd/login.c | 37 +++++++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index ba4a97e49..c1a3bce7a 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,10 @@ +Thu Jun 5 15:56:54 1997 Theodore Ts'o + + * login.c: Always use the new tty line discpline. [krb5-appl/428] + + * login.c: If a hangup signal is received, pass it onto the child. + [krb5-appl/432] + Fri Mar 28 01:05:27 1997 Theodore Y. Ts'o * login.c (NO_MOTD): If we're on an SGI machine, don't do the MOTD diff --git a/src/appl/bsd/login.c b/src/appl/bsd/login.c index 41236465b..d75a53228 100644 --- a/src/appl/bsd/login.c +++ b/src/appl/bsd/login.c @@ -1801,11 +1801,9 @@ int rewrite_ccache = 1; /*try to write out ccache*/ if (*pwd->pw_shell == '\0') pwd->pw_shell = BSHELL; #if defined(NTTYDISC) && defined(TIOCSETD) - /* turn on new line discipline for the csh */ - if (!strcmp(pwd->pw_shell, "/bin/csh")) { - ioctlval = NTTYDISC; - (void)ioctl(0, TIOCSETD, (char *)&ioctlval); - } + /* turn on new line discipline for all shells */ + ioctlval = NTTYDISC; + (void)ioctl(0, TIOCSETD, (char *)&ioctlval); #endif ccname = getenv("KRB5CCNAME"); /* save cache */ @@ -2386,6 +2384,13 @@ void sleepexit(eval) } #if defined(KRB4_GET_TICKETS) || defined(KRB5_GET_TICKETS) + +static int hungup = 0; +static sigtype +sighup() { + hungup = 1; +} + /* call already conditionalized on login_krb4_get_tickets */ /* * This routine handles cleanup stuff, and the like. @@ -2395,8 +2400,9 @@ void sleepexit(eval) void dofork() { - int child; - + int child,pid; + handler sa; + #ifdef _IBMR2 update_ref_count(1); #endif @@ -2433,15 +2439,26 @@ dofork() (void) chdir("/"); /* Let's not keep the fs busy... */ /* If we're the parent, watch the child until it dies */ + + /* On receipt of SIGHUP, pass that along to child's process group. */ + handler_init (sa, sighup); + handler_set (SIGHUP, sa); + + while (1) { #ifdef HAVE_WAITPID - (void)waitpid(child, 0, 0); + pid = waitpid(child, 0, 0); #else #ifdef WAIT_USES_INT - while(wait((int *)0) != child) /*void*/ ; + pid = wait((int *)0); #else - while(wait((union wait *)0) != child) /*void*/ ; + pid = wait((union wait *)0); #endif #endif + if (hungup) + killpg(child, SIGHUP); + if (pid == child) + break; + } /* Cleanup stuff */ /* Run destroy_tickets to destroy tickets */ -- 2.26.2