diff options
author | mg147109 <none@none> | 2006-06-15 04:45:02 -0700 |
---|---|---|
committer | mg147109 <none@none> | 2006-06-15 04:45:02 -0700 |
commit | 2b51d29a0450e65005bfc1c43520e6ebb13778ce (patch) | |
tree | 35d8c8987e123865324ee9e30cdc275926225cd8 /usr/src/cmd/csh/sh.c | |
parent | 1d452cf5123cb6ac0a013a4dbd4dcceeb0da314d (diff) | |
download | illumos-joyent-2b51d29a0450e65005bfc1c43520e6ebb13778ce.tar.gz |
6230795 C-Shell leaves process running after termination.
Diffstat (limited to 'usr/src/cmd/csh/sh.c')
-rw-r--r-- | usr/src/cmd/csh/sh.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/usr/src/cmd/csh/sh.c b/usr/src/cmd/csh/sh.c index f03ffbbaf6..da000b4c14 100644 --- a/usr/src/cmd/csh/sh.c +++ b/usr/src/cmd/csh/sh.c @@ -55,6 +55,10 @@ extern gid_t getegid(), getgid(); extern uid_t geteuid(), getuid(); extern tchar **strblktotsblk(/* char **, int */); +extern void hupforegnd(void); +void interactive_hup(void); +void interactive_login_hup(void); + void importpath(tchar *); void srccat(tchar *, tchar *); void srccat_inlogin(tchar *, tchar *); @@ -441,6 +445,17 @@ main(int c, char **av) (void) signal(SIGINT, pintr); (void) sigblock(sigmask(SIGINT)); (void) signal(SIGTERM, SIG_IGN); + + /* + * Explicitly terminate foreground jobs and exit if we are + * interactive shell + */ + if (loginsh) { + (void) signal(SIGHUP, interactive_login_hup); + } else { + (void) signal(SIGHUP, interactive_hup); + } + if (quitit == 0 && arginp == 0) { (void) signal(SIGTSTP, SIG_IGN); (void) signal(SIGTTIN, SIG_IGN); @@ -837,6 +852,21 @@ phup(void) exit(1); } +void +interactive_hup(void) +{ + hupforegnd(); + exit(1); +} + +void +interactive_login_hup(void) +{ + rechist(); + hupforegnd(); + exit(1); +} + tchar *jobargv[2] = { S_jobs /* "jobs" */, 0 }; /* * Catch an interrupt, e.g. during lexical input. |