summaryrefslogtreecommitdiff
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index da92e01aba6b..6031800c94cf 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1249,16 +1249,19 @@ static struct task_struct *copy_process(unsigned long clone_flags,
__ptrace_link(p, current->parent);
if (thread_group_leader(p)) {
+ pid_t pgid = process_group(current);
+ pid_t sid = process_session(current);
+
p->signal->tty = current->signal->tty;
- p->signal->pgrp = process_group(current);
+ p->signal->pgrp = pgid;
set_signal_session(p->signal, process_session(current));
- attach_pid(p, PIDTYPE_PGID, process_group(p));
- attach_pid(p, PIDTYPE_SID, process_session(p));
+ attach_pid(p, PIDTYPE_PGID, find_pid(pgid));
+ attach_pid(p, PIDTYPE_SID, find_pid(sid));
list_add_tail_rcu(&p->tasks, &init_task.tasks);
__get_cpu_var(process_counts)++;
}
- attach_pid(p, PIDTYPE_PID, p->pid);
+ attach_pid(p, PIDTYPE_PID, find_pid(p->pid));
nr_threads++;
}