summaryrefslogtreecommitdiffstats
path: root/kernel/sys.c
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-07-04 00:08:26 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 01:08:02 +0200
commit81dabb464139324c005159f5afba377104d8828d (patch)
tree6f105f6a2a4f32b8ff45efb51889b172452e7282 /kernel/sys.c
parentfs/exec.c:de_thread(): use change_pid() rather than detach_pid/attach_pid (diff)
downloadlinux-81dabb464139324c005159f5afba377104d8828d.tar.xz
linux-81dabb464139324c005159f5afba377104d8828d.zip
exit.c: unexport __set_special_pids()
Move __set_special_pids() from exit.c to sys.c close to its single caller and make it static. And rename it to set_special_pids(), another helper with this name has gone away. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r--kernel/sys.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/sys.c b/kernel/sys.c
index 7bf50dcc6d53..071de900c824 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1309,6 +1309,17 @@ out:
return retval;
}
+static void set_special_pids(struct pid *pid)
+{
+ struct task_struct *curr = current->group_leader;
+
+ if (task_session(curr) != pid)
+ change_pid(curr, PIDTYPE_SID, pid);
+
+ if (task_pgrp(curr) != pid)
+ change_pid(curr, PIDTYPE_PGID, pid);
+}
+
SYSCALL_DEFINE0(setsid)
{
struct task_struct *group_leader = current->group_leader;
@@ -1328,7 +1339,7 @@ SYSCALL_DEFINE0(setsid)
goto out;
group_leader->signal->leader = 1;
- __set_special_pids(sid);
+ set_special_pids(sid);
proc_clear_tty(group_leader);