Go to the previous, next section.
int setrugid(gid_t ruid, gid_t euid);
rgid: [in] the new real uid, -1 for no change.
egid: [in] the new effective uid, -1 for no change.
Sets both the real and effective uid of the task. If the calling task does not have superuser privileges, it can only swap its real and effective uids. If the calling task has superuser privileges, it can set the effective and real uids to whatever it wants. The saved uid is set to the same value of the effective uid. 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 uid to the real uid and the real uid to
the effective uid and the task does not have superuser privileges.
Go to the previous, next section.