From: Sam Hartman Date: Thu, 3 Aug 1995 19:26:56 +0000 (+0000) Subject: Attempt to HUP processes associated with the pty when it is revoked if X-Git-Tag: krb5-1.0-beta6~1421 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a1fc76083d7ddc56d7ad2d994250d903a31a6311;p=krb5.git Attempt to HUP processes associated with the pty when it is revoked if vhangup is not available. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6402 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 0a4c2cf9f..a8aa1cbef 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 3 15:04:34 1995 Sam Hartman + + * configure.in: Check for vhangup and killpg. + + * cleanup.c (pty_cleanup): Kill the process group associated with + the pty if using revoke. This won't always work, but will at + least attempt to remove processes associated with the pty. + Wed Aug 2 11:59:19 1995 Sam Hartman * init.c (pty_init): New file to handle initialization--currently only error tables. diff --git a/src/util/pty/cleanup.c b/src/util/pty/cleanup.c index d9103a472..c5726bd6f 100644 --- a/src/util/pty/cleanup.c +++ b/src/util/pty/cleanup.c @@ -45,6 +45,22 @@ long pty_cleanup (slave, pid, update_utmp) #endif #ifdef HAVE_REVOKE revoke(slave); + /* + * Revoke isn't guaranteed to send a SIGHUP to the processes it + * dissociates from the terminal. The best solution without a Posix + * mechanism for forcing a hangup is to killpg() the process + * group of the pty. This will at least kill the shell and + * hopefully, the child processes. This is not always the case, however. + * If the shell puts each job in a process group and doesn't pass + * along SIGHUP, all processes may not die. + */ + if ( pid > 0 ) { + #ifdef HAVE_KILLPG + killpg(pid, SIGHUP); + #else + kill( -(pid), SIGHUP ); +#endif /*HAVE_KILLPG*/ + } #else /* HAVE_REVOKE*/ #ifdef VHANG_LAST if ( retval = ( pty_open_ctty( slave, &fd ))) diff --git a/src/util/pty/configure.in b/src/util/pty/configure.in index 572fc13b5..76a611652 100644 --- a/src/util/pty/configure.in +++ b/src/util/pty/configure.in @@ -6,7 +6,7 @@ LinkFileDir([$](TOPLIBD)/libpty.a,libpty.a,../util/pty) AC_PROG_INSTALL AC_PROG_ARCHIVE AC_PROG_RANLIB -AC_CHECK_FUNCS(fchmod fchown revoke) +AC_CHECK_FUNCS(fchmod fchown revoke vhangup killpg) dnl dbm libs for use of an_to_ln LOGINLIBS= dnl