* 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:
@@ -67,16 +67,21 @@ getpgid(pid_t process)
|
|||||||
int
|
int
|
||||||
setpgid(pid_t process, pid_t group)
|
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
|
pid_t
|
||||||
setpgrp(void)
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user