* setpgid() is not supposed to return the group ID. It shall return 0 on

success.
* setpgrp() is not supposed to fail (could happen, if the calling
  process was a session leader).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24040 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2008-02-21 00:18:35 +00:00
parent 3a0782dc15
commit b097a59b43

View File

@ -67,16 +67,21 @@ getpgid(pid_t process)
int
setpgid(pid_t process, pid_t group)
{
status_t status = _kern_setpgid(process, group);
pid_t result = _kern_setpgid(process, group);
if (result >= 0)
return 0;
RETURN_AND_SET_ERRNO(status);
RETURN_AND_SET_ERRNO(result);
}
pid_t
setpgrp(void)
{
return setpgid(0, 0);
// setpgrp() never fails -- setpgid() fails when the process is a session
// leader, though.
pid_t result = _kern_setpgid(0, 0);
return result >= 0 ? result : getpgrp();
}