Commit 39221a1a authored by Roland McGrath's avatar Roland McGrath Committed by Linus Torvalds

[PATCH] session leader tty disassociation fix

The session leader should disassociate from its controlling terminal and
send SIGHUP signals only when the whole session leader process dies. 
Currently, this gets done when any thread in that process dies, which is
wrong.  This patch fixes it.  
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent dd8e157f
......@@ -783,6 +783,7 @@ static void exit_notify(struct task_struct *tsk)
asmlinkage NORET_TYPE void do_exit(long code)
{
struct task_struct *tsk = current;
int group_dead;
profile_task_exit(tsk);
......@@ -807,7 +808,8 @@ asmlinkage NORET_TYPE void do_exit(long code)
ptrace_notify((PTRACE_EVENT_EXIT << 8) | SIGTRAP);
}
if (atomic_dec_and_test(&tsk->signal->live))
group_dead = atomic_dec_and_test(&tsk->signal->live);
if (group_dead)
acct_process(code);
__exit_mm(tsk);
......@@ -818,7 +820,7 @@ asmlinkage NORET_TYPE void do_exit(long code)
exit_thread();
exit_keys(tsk);
if (tsk->signal->leader)
if (group_dead && tsk->signal->leader)
disassociate_ctty(1);
module_put(tsk->thread_info->exec_domain->module);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment