Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16994
b: refs/heads/master
c: ee0acf9
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Jan 9, 2006
1 parent af038e3 commit 3dc7916
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9a5d3023e626a0baf86ac6b892c983b3db13f22b
refs/heads/master: ee0acf90d320c29916ba8c5c1b2e908d81f5057d
11 changes: 6 additions & 5 deletions trunk/kernel/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,10 +1090,11 @@ asmlinkage long sys_times(struct tms __user * tbuf)
asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
{
struct task_struct *p;
struct task_struct *group_leader = current->group_leader;
int err = -EINVAL;

if (!pid)
pid = current->pid;
pid = group_leader->pid;
if (!pgid)
pgid = pid;
if (pgid < 0)
Expand All @@ -1113,16 +1114,16 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
if (!thread_group_leader(p))
goto out;

if (p->parent == current || p->real_parent == current) {
if (p->parent == current || p->real_parent == group_leader) {
err = -EPERM;
if (p->signal->session != current->signal->session)
if (p->signal->session != group_leader->signal->session)
goto out;
err = -EACCES;
if (p->did_exec)
goto out;
} else {
err = -ESRCH;
if (p != current)
if (p != group_leader)
goto out;
}

Expand All @@ -1134,7 +1135,7 @@ asmlinkage long sys_setpgid(pid_t pid, pid_t pgid)
struct task_struct *p;

do_each_task_pid(pgid, PIDTYPE_PGID, p) {
if (p->signal->session == current->signal->session)
if (p->signal->session == group_leader->signal->session)
goto ok_pgid;
} while_each_task_pid(pgid, PIDTYPE_PGID, p);
goto out;
Expand Down

0 comments on commit 3dc7916

Please sign in to comment.