diff options
| author | Sam Hartman <hartmans@mit.edu> | 1995-08-03 19:26:56 +0000 |
|---|---|---|
| committer | Sam Hartman <hartmans@mit.edu> | 1995-08-03 19:26:56 +0000 |
| commit | a1fc76083d7ddc56d7ad2d994250d903a31a6311 (patch) | |
| tree | 81e87dc2b3fbd7edde24a743e22fe0994959d771 /src | |
| parent | b6ffb9db73205d3a63daa6d2f18fa9b1dd36dc27 (diff) | |
| download | krb5-a1fc76083d7ddc56d7ad2d994250d903a31a6311.tar.gz krb5-a1fc76083d7ddc56d7ad2d994250d903a31a6311.tar.xz krb5-a1fc76083d7ddc56d7ad2d994250d903a31a6311.zip | |
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
Diffstat (limited to 'src')
| -rw-r--r-- | src/util/pty/ChangeLog | 8 | ||||
| -rw-r--r-- | src/util/pty/cleanup.c | 16 | ||||
| -rw-r--r-- | src/util/pty/configure.in | 2 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 0a4c2cf9f2..a8aa1cbef3 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,11 @@ +Thu Aug 3 15:04:34 1995 Sam Hartman <hartmans@tertius.mit.edu> + + * 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 <hartmans@tertius.mit.edu> * 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 d9103a472c..c5726bd6f9 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 572fc13b5c..76a6116529 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 |
