diff options
author | Oren Laadan <orenl@cs.columbia.edu> | 2006-01-08 12:03:58 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-09 07:14:01 +0300 |
commit | e19f247a3dbd85485ec13174817ae9c2478fe541 (patch) | |
tree | 1d6f6fa28d70d51d1ce71264b07ec1afd768e9a6 /kernel/sys.c | |
parent | ee0acf90d320c29916ba8c5c1b2e908d81f5057d (diff) | |
download | linux-e19f247a3dbd85485ec13174817ae9c2478fe541.tar.xz |
[PATCH] setpgid: should work for sub-threads
setsid() does not work unless the calling process is a
thread_group_leader().
'man setpgid' does not tell anything about that, so I consider this
behaviour is a bug.
Signed-off-by: Oren Laadan <orenl@cs.columbia.edu>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 43e557211d8d..f497bf56ada1 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1215,24 +1215,22 @@ asmlinkage long sys_getsid(pid_t pid) asmlinkage long sys_setsid(void) { + struct task_struct *group_leader = current->group_leader; struct pid *pid; int err = -EPERM; - if (!thread_group_leader(current)) - return -EINVAL; - down(&tty_sem); write_lock_irq(&tasklist_lock); - pid = find_pid(PIDTYPE_PGID, current->pid); + pid = find_pid(PIDTYPE_PGID, group_leader->pid); if (pid) goto out; - current->signal->leader = 1; - __set_special_pids(current->pid, current->pid); - current->signal->tty = NULL; - current->signal->tty_old_pgrp = 0; - err = process_group(current); + group_leader->signal->leader = 1; + __set_special_pids(group_leader->pid, group_leader->pid); + group_leader->signal->tty = NULL; + group_leader->signal->tty_old_pgrp = 0; + err = process_group(group_leader); out: write_unlock_irq(&tasklist_lock); up(&tty_sem); |