set real and effective group IDs
int setregid(gid_t rgid, gid_t egid);
is used to set the real and effective group
of the calling process.
is -1, the real
is not changed; if
is -1, the effective
is not changed.
The real and effective
may be set to different values in the same call.
If the calling process has the P_SETUID privilege,
and the effective
can be set to any valid value.
If the calling process does not have the P_SETUID privilege,
either the real
can be set to the saved setGID
or the effective
can either be set to the saved setGID
or the real
Note: if a setGID process sets its effective
to its real
it can still set its effective
back to the saved setGID.
Upon successful completion, a value of 0 is returned.
Otherwise, a value of -1 is returned and
is set to indicate the error.
will fail and neither of the group
will be changed if:
The value of rgid or egid is invalid or out of range.
The calling process does not have the P_SETUID privilege,
and a change other than changing the real GID to the saved
setGID, or changing the effective GID to the real
GID or the saved GID, was specified.
If a user application calling this routine was compiled on SCO OpenServer,
then the P_SETUID privilege is not required.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004