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,6 +939,9 @@ static int sys_setpgid(pid_t pid, pid_t pgid) {
return -EPERM; return -EPERM;
} }
if (pgid == 0) {
proc->job = proc->group;
} else {
process_t * pgroup = process_from_pid(pgid); process_t * pgroup = process_from_pid(pgid);
if (!pgroup) { if (!pgroup) {
@ -951,9 +954,6 @@ static int sys_setpgid(pid_t pid, pid_t pgid) {
return -EPERM; return -EPERM;
} }
if (pgid == 0) {
proc->job = proc->group;
} else {
proc->job = pgid; proc->job = pgid;
} }
return 0; return 0;