diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-08-23 14:56:33 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-08-23 14:56:33 +0000 |
commit | 374e45ee0438eee8c62b6409b14da6f9f3d3da46 (patch) | |
tree | 6883bde44bd0c3992bcc765097c46855d72652cf | |
parent | 4b1554d5505576be0982e448c6c89391d283ad08 (diff) |
Don't send SIGINT or SIGTERM to the entire processes group when the
shell receives SIGINT/SIGTERM unless the shell is the process group
leader. Fixes PR 3820. OK danh@ sturm@ miod@
-rw-r--r-- | bin/ksh/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c index 352add1f797..8c7b8b95469 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.27 2004/06/07 23:20:46 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $ */ /* * startup, main loop, environments and error handling @@ -731,7 +731,8 @@ quitenv() * Don't do it for SIGQUIT, since we'd * dump a core.. */ - if (sig == SIGINT || sig == SIGTERM) { + if ((sig == SIGINT || sig == SIGTERM) && + getpgrp() == kshpid) { setsig(&sigtraps[sig], SIG_DFL, SS_RESTORE_CURR|SS_FORCE); kill(0, sig); |