Go to the previous, next section.
int setregid(gid_t rgid, gid_t egid);
rgid: [in] the new real gid, -1 for no change.
egid: [in] the new effective gid, -1 for no change.
Sets both the real and effective gid of the task. If the calling task does not have superuser privileges, it can only swap its real and effective gids. If the calling task has superuser privileges, it can set the effective and real gids to whatever it wants. The saved gid is set to the same value of the effective gid. This is done so that a programm using this call will be considered 100% BSD compatible.
On success, returns 0. On error, returns -1 and errno
is set to
one of the following values: EPERM
: the task tried something else
than just changing the effective gid to the real gid and the real gid to
the effective gid and the task does not have superuser privileges.
Go to the previous, next section.