kernel: setpgid fix

This commit is contained in:
K. Lange 2018-10-26 23:15:08 +09:00
parent 3d2e94d387
commit 5aaaf9f8ce

View File

@ -939,21 +939,21 @@ static int sys_setpgid(pid_t pid, pid_t pgid) {
return -EPERM; return -EPERM;
} }
process_t * pgroup = process_from_pid(pgid);
if (!pgroup) {
debug_print(WARNING, "bad session id");
return -EPERM;
}
if (pgroup->session != proc->session) {
debug_print(WARNING, "tried to move to different session");
return -EPERM;
}
if (pgid == 0) { if (pgid == 0) {
proc->job = proc->group; proc->job = proc->group;
} else { } else {
process_t * pgroup = process_from_pid(pgid);
if (!pgroup) {
debug_print(WARNING, "bad session id");
return -EPERM;
}
if (pgroup->session != proc->session) {
debug_print(WARNING, "tried to move to different session");
return -EPERM;
}
proc->job = pgid; proc->job = pgid;
} }
return 0; return 0;